| 1 | <?php |
|---|
| 2 | // $Id: main.php,v 1.6 2006/05/01 02:37:29 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------ // |
|---|
| 27 | // Author: Kazumi Ono (AKA onokazu) // |
|---|
| 28 | // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // |
|---|
| 29 | // Project: The XOOPS Project // |
|---|
| 30 | // ------------------------------------------------------------------------- // |
|---|
| 31 | |
|---|
| 32 | if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|---|
| 33 | exit("Access Denied"); |
|---|
| 34 | } |
|---|
| 35 | $op = "form"; |
|---|
| 36 | |
|---|
| 37 | if ( isset($_POST['op']) && $_POST['op'] == "submit" ) { |
|---|
| 38 | $op = "submit"; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | xoops_cp_header(); |
|---|
| 42 | //OpenTable(); |
|---|
| 43 | |
|---|
| 44 | if ( $op == "form" ) { |
|---|
| 45 | $member_handler =& xoops_gethandler('member'); |
|---|
| 46 | $acttotal = $member_handler->getUserCount(new Criteria('level', 0, '>')); |
|---|
| 47 | $inacttotal = $member_handler->getUserCount(new Criteria('level', 0)); |
|---|
| 48 | include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
|---|
| 49 | $uname_text = new XoopsFormText("", "user_uname", 30, 60); |
|---|
| 50 | $uname_match = new XoopsFormSelectMatchOption("", "user_uname_match"); |
|---|
| 51 | $uname_tray = new XoopsFormElementTray(_AM_UNAME, " "); |
|---|
| 52 | $uname_tray->addElement($uname_match); |
|---|
| 53 | $uname_tray->addElement($uname_text); |
|---|
| 54 | $name_text = new XoopsFormText("", "user_name", 30, 60); |
|---|
| 55 | $name_match = new XoopsFormSelectMatchOption("", "user_name_match"); |
|---|
| 56 | $name_tray = new XoopsFormElementTray(_AM_REALNAME, " "); |
|---|
| 57 | $name_tray->addElement($name_match); |
|---|
| 58 | $name_tray->addElement($name_text); |
|---|
| 59 | $email_text = new XoopsFormText("", "user_email", 30, 60); |
|---|
| 60 | $email_match = new XoopsFormSelectMatchOption("", "user_email_match"); |
|---|
| 61 | $email_tray = new XoopsFormElementTray(_AM_EMAIL, " "); |
|---|
| 62 | $email_tray->addElement($email_match); |
|---|
| 63 | $email_tray->addElement($email_text); |
|---|
| 64 | $url_text = new XoopsFormText(_AM_URLC, "user_url", 30, 100); |
|---|
| 65 | //$theme_select = new XoopsFormSelectTheme(_AM_THEME, "user_theme"); |
|---|
| 66 | //$timezone_select = new XoopsFormSelectTimezone(_AM_TIMEZONE, "user_timezone_offset"); |
|---|
| 67 | $icq_text = new XoopsFormText("", "user_icq", 30, 100); |
|---|
| 68 | $icq_match = new XoopsFormSelectMatchOption("", "user_icq_match"); |
|---|
| 69 | $icq_tray = new XoopsFormElementTray(_AM_ICQ, " "); |
|---|
| 70 | $icq_tray->addElement($icq_match); |
|---|
| 71 | $icq_tray->addElement($icq_text); |
|---|
| 72 | $aim_text = new XoopsFormText("", "user_aim", 30, 100); |
|---|
| 73 | $aim_match = new XoopsFormSelectMatchOption("", "user_aim_match"); |
|---|
| 74 | $aim_tray = new XoopsFormElementTray(_AM_AIM, " "); |
|---|
| 75 | $aim_tray->addElement($aim_match); |
|---|
| 76 | $aim_tray->addElement($aim_text); |
|---|
| 77 | $yim_text = new XoopsFormText("", "user_yim", 30, 100); |
|---|
| 78 | $yim_match = new XoopsFormSelectMatchOption("", "user_yim_match"); |
|---|
| 79 | $yim_tray = new XoopsFormElementTray(_AM_YIM, " "); |
|---|
| 80 | $yim_tray->addElement($yim_match); |
|---|
| 81 | $yim_tray->addElement($yim_text); |
|---|
| 82 | $msnm_text = new XoopsFormText("", "user_msnm", 30, 100); |
|---|
| 83 | $msnm_match = new XoopsFormSelectMatchOption("", "user_msnm_match"); |
|---|
| 84 | $msnm_tray = new XoopsFormElementTray(_AM_MSNM, " "); |
|---|
| 85 | $msnm_tray->addElement($msnm_match); |
|---|
| 86 | $msnm_tray->addElement($msnm_text); |
|---|
| 87 | $location_text = new XoopsFormText(_AM_LOCATION, "user_from", 30, 100); |
|---|
| 88 | $occupation_text = new XoopsFormText(_AM_OCCUPATION, "user_occ", 30, 100); |
|---|
| 89 | $interest_text = new XoopsFormText(_AM_INTEREST, "user_intrest", 30, 100); |
|---|
| 90 | |
|---|
| 91 | //$bio_text = new XoopsFormText(_AM_EXTRAINFO, "user_bio", 30, 100); |
|---|
| 92 | $lastlog_more = new XoopsFormText(_AM_LASTLOGMORE, "user_lastlog_more", 10, 5); |
|---|
| 93 | $lastlog_less = new XoopsFormText(_AM_LASTLOGLESS, "user_lastlog_less", 10, 5); |
|---|
| 94 | $reg_more = new XoopsFormText(_AM_REGMORE, "user_reg_more", 10, 5); |
|---|
| 95 | $reg_less = new XoopsFormText(_AM_REGLESS, "user_reg_less", 10, 5); |
|---|
| 96 | $posts_more = new XoopsFormText(_AM_POSTSMORE, "user_posts_more", 10, 5); |
|---|
| 97 | $posts_less = new XoopsFormText(_AM_POSTSLESS, "user_posts_less", 10, 5); |
|---|
| 98 | $mailok_radio = new XoopsFormRadio(_AM_SHOWMAILOK, "user_mailok", "both"); |
|---|
| 99 | $mailok_radio->addOptionArray(array("mailok"=>_AM_MAILOK, "mailng"=>_AM_MAILNG, "both"=>_AM_BOTH)); |
|---|
| 100 | $type_radio = new XoopsFormRadio(_AM_SHOWTYPE, "user_type", "actv"); |
|---|
| 101 | $type_radio->addOptionArray(array("actv"=>_AM_ACTIVE, "inactv"=>_AM_INACTIVE, "both"=>_AM_BOTH)); |
|---|
| 102 | $sort_select = new XoopsFormSelect(_AM_SORT, "user_sort"); |
|---|
| 103 | $sort_select->addOptionArray(array("uname"=>_AM_UNAME,"email"=>_AM_EMAIL,"last_login"=>_AM_LASTLOGIN,"user_regdate"=>_AM_REGDATE,"posts"=>_AM_POSTS)); |
|---|
| 104 | $order_select = new XoopsFormSelect(_AM_ORDER, "user_order"); |
|---|
| 105 | $order_select->addOptionArray(array("ASC"=>_AM_ASC,"DESC"=>_AM_DESC)); |
|---|
| 106 | $limit_text = new XoopsFormText(_AM_LIMIT, "limit", 6, 2); |
|---|
| 107 | $fct_hidden = new XoopsFormHidden("fct", "findusers"); |
|---|
| 108 | $op_hidden = new XoopsFormHidden("op", "submit"); |
|---|
| 109 | $submit_button = new XoopsFormButton("", "user_submit", _SUBMIT, "submit"); |
|---|
| 110 | |
|---|
| 111 | $form = new XoopsThemeForm(_AM_FINDUS, "uesr_findform", "admin.php"); |
|---|
| 112 | $form->addElement($uname_tray); |
|---|
| 113 | $form->addElement($name_tray); |
|---|
| 114 | $form->addElement($email_tray); |
|---|
| 115 | //$form->addElement($theme_select); |
|---|
| 116 | //$form->addElement($timezone_select); |
|---|
| 117 | $form->addElement($icq_tray); |
|---|
| 118 | $form->addElement($aim_tray); |
|---|
| 119 | $form->addElement($yim_tray); |
|---|
| 120 | $form->addElement($msnm_tray); |
|---|
| 121 | $form->addElement($url_text); |
|---|
| 122 | $form->addElement($location_text); |
|---|
| 123 | $form->addElement($occupation_text); |
|---|
| 124 | $form->addElement($interest_text); |
|---|
| 125 | //$form->addElement($bio_text); |
|---|
| 126 | $form->addElement($lastlog_more); |
|---|
| 127 | $form->addElement($lastlog_less); |
|---|
| 128 | $form->addElement($reg_more); |
|---|
| 129 | $form->addElement($reg_less); |
|---|
| 130 | $form->addElement($posts_more); |
|---|
| 131 | $form->addElement($posts_less); |
|---|
| 132 | $form->addElement($mailok_radio); |
|---|
| 133 | $form->addElement($type_radio); |
|---|
| 134 | $form->addElement($sort_select); |
|---|
| 135 | $form->addElement($order_select); |
|---|
| 136 | $form->addElement($fct_hidden); |
|---|
| 137 | $form->addElement($limit_text); |
|---|
| 138 | $form->addElement($op_hidden); |
|---|
| 139 | |
|---|
| 140 | // if this is to find users for a specific group |
|---|
| 141 | if ( !empty($_GET['group']) && intval($_GET['group']) > 0 ) { |
|---|
| 142 | $group_hidden = new XoopsFormHidden("group", intval($_GET['group'])); |
|---|
| 143 | $form->addElement($group_hidden); |
|---|
| 144 | } |
|---|
| 145 | $form->addElement($submit_button); |
|---|
| 146 | echo "<h4 style='text-align:left;'>"._AM_FINDUS."</h4>(".sprintf(_AM_ACTUS, "<span style='color:#ff0000;'>$acttotal</span>")." ".sprintf(_AM_INACTUS, "<span style='color:#ff0000;'>$inacttotal</span>").")"; |
|---|
| 147 | $form->display(); |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | if ( $op == "submit" ) { |
|---|
| 151 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 152 | $criteria = new CriteriaCompo(); |
|---|
| 153 | if ( !empty($_POST['user_uname']) ) { |
|---|
| 154 | $match = (!empty($_POST['user_uname_match'])) ? intval($_POST['user_uname_match']) : XOOPS_MATCH_START; |
|---|
| 155 | switch ($match) { |
|---|
| 156 | case XOOPS_MATCH_START: |
|---|
| 157 | $criteria->add(new Criteria('uname', $myts->addSlashes(trim($_POST['user_uname'])).'%', 'LIKE')); |
|---|
| 158 | break; |
|---|
| 159 | case XOOPS_MATCH_END: |
|---|
| 160 | $criteria->add(new Criteria('uname', '%'.$myts->addSlashes(trim($_POST['user_uname'])), 'LIKE')); |
|---|
| 161 | break; |
|---|
| 162 | case XOOPS_MATCH_EQUAL: |
|---|
| 163 | $criteria->add(new Criteria('uname', $myts->addSlashes(trim($_POST['user_uname'])))); |
|---|
| 164 | break; |
|---|
| 165 | case XOOPS_MATCH_CONTAIN: |
|---|
| 166 | $criteria->add(new Criteria('uname', '%'.$myts->addSlashes(trim($_POST['user_uname'])).'%', 'LIKE')); |
|---|
| 167 | break; |
|---|
| 168 | } |
|---|
| 169 | } |
|---|
| 170 | if ( !empty($_POST['user_name']) ) { |
|---|
| 171 | $match = (!empty($_POST['user_name_match'])) ? intval($_POST['user_name_match']) : XOOPS_MATCH_START; |
|---|
| 172 | switch ($match) { |
|---|
| 173 | case XOOPS_MATCH_START: |
|---|
| 174 | $criteria->add(new Criteria('name', $myts->addSlashes(trim($_POST['user_name'])).'%', 'LIKE')); |
|---|
| 175 | break; |
|---|
| 176 | case XOOPS_MATCH_END: |
|---|
| 177 | $criteria->add(new Criteria('name', '%'.$myts->addSlashes(trim($_POST['user_name'])), 'LIKE')); |
|---|
| 178 | break; |
|---|
| 179 | case XOOPS_MATCH_EQUAL: |
|---|
| 180 | $criteria->add(new Criteria('name', $myts->addSlashes(trim($_POST['user_name'])))); |
|---|
| 181 | break; |
|---|
| 182 | case XOOPS_MATCH_CONTAIN: |
|---|
| 183 | $criteria->add(new Criteria('name', '%'.$myts->addSlashes(trim($_POST['user_name'])).'%', 'LIKE')); |
|---|
| 184 | break; |
|---|
| 185 | } |
|---|
| 186 | } |
|---|
| 187 | if ( !empty($_POST['user_email']) ) { |
|---|
| 188 | $match = (!empty($_POST['user_email_match'])) ? intval($_POST['user_email_match']) : XOOPS_MATCH_START; |
|---|
| 189 | switch ($match) { |
|---|
| 190 | case XOOPS_MATCH_START: |
|---|
| 191 | $criteria->add(new Criteria('email', $myts->addSlashes(trim($_POST['user_email'])).'%', 'LIKE')); |
|---|
| 192 | break; |
|---|
| 193 | case XOOPS_MATCH_END: |
|---|
| 194 | $criteria->add(new Criteria('email', '%'.$myts->addSlashes(trim($_POST['user_email'])), 'LIKE')); |
|---|
| 195 | break; |
|---|
| 196 | case XOOPS_MATCH_EQUAL: |
|---|
| 197 | $criteria->add(new Criteria('email', $myts->addSlashes(trim($_POST['user_email'])))); |
|---|
| 198 | break; |
|---|
| 199 | case XOOPS_MATCH_CONTAIN: |
|---|
| 200 | $criteria->add(new Criteria('email', '%'.$myts->addSlashes(trim($_POST['user_email'])).'%', 'LIKE')); |
|---|
| 201 | break; |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | if ( !empty($_POST['user_url']) ) { |
|---|
| 205 | $url = formatURL(trim($_POST['user_url'])); |
|---|
| 206 | $criteria->add(new Criteria('url', $url.'%', 'LIKE')); |
|---|
| 207 | } |
|---|
| 208 | if ( !empty($_POST['user_icq']) ) { |
|---|
| 209 | $match = (!empty($_POST['user_icq_match'])) ? intval($_POST['user_icq_match']) : XOOPS_MATCH_START; |
|---|
| 210 | switch ($match) { |
|---|
| 211 | case XOOPS_MATCH_START: |
|---|
| 212 | $criteria->add(new Criteria('user_icq', $myts->addSlashes(trim($_POST['user_icq'])).'%', 'LIKE')); |
|---|
| 213 | break; |
|---|
| 214 | case XOOPS_MATCH_END: |
|---|
| 215 | $criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($_POST['user_icq'])), 'LIKE')); |
|---|
| 216 | break; |
|---|
| 217 | case XOOPS_MATCH_EQUAL: |
|---|
| 218 | $criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($_POST['user_icq'])))); |
|---|
| 219 | break; |
|---|
| 220 | case XOOPS_MATCH_CONTAIN: |
|---|
| 221 | $criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($_POST['user_icq'])).'%', 'LIKE')); |
|---|
| 222 | break; |
|---|
| 223 | } |
|---|
| 224 | } |
|---|
| 225 | if ( !empty($_POST['user_aim']) ) { |
|---|
| 226 | $match = (!empty($_POST['user_aim_match'])) ? intval($_POST['user_aim_match']) : XOOPS_MATCH_START; |
|---|
| 227 | switch ($match) { |
|---|
| 228 | case XOOPS_MATCH_START: |
|---|
| 229 | $criteria->add(new Criteria('user_aim', $myts->addSlashes(trim($_POST['user_aim'])).'%', 'LIKE')); |
|---|
| 230 | break; |
|---|
| 231 | case XOOPS_MATCH_END: |
|---|
| 232 | $criteria->add(new Criteria('user_aim', '%'.$myts->addSlashes(trim($_POST['user_aim'])), 'LIKE')); |
|---|
| 233 | break; |
|---|
| 234 | case XOOPS_MATCH_EQUAL: |
|---|
| 235 | $criteria->add(new Criteria('user_aim', $myts->addSlashes(trim($_POST['user_aim'])))); |
|---|
| 236 | break; |
|---|
| 237 | case XOOPS_MATCH_CONTAIN: |
|---|
| 238 | $criteria->add(new Criteria('user_aim', '%'.$myts->addSlashes(trim($_POST['user_aim'])).'%', 'LIKE')); |
|---|
| 239 | break; |
|---|
| 240 | } |
|---|
| 241 | } |
|---|
| 242 | if ( !empty($_POST['user_yim']) ) { |
|---|
| 243 | $match = (!empty($_POST['user_yim_match'])) ? intval($_POST['user_yim_match']) : XOOPS_MATCH_START; |
|---|
| 244 | switch ($match) { |
|---|
| 245 | case XOOPS_MATCH_START: |
|---|
| 246 | $criteria->add(new Criteria('user_yim', $myts->addSlashes(trim($_POST['user_yim'])).'%', 'LIKE')); |
|---|
| 247 | break; |
|---|
| 248 | case XOOPS_MATCH_END: |
|---|
| 249 | $criteria->add(new Criteria('user_yim', '%'.$myts->addSlashes(trim($_POST['user_yim'])), 'LIKE')); |
|---|
| 250 | break; |
|---|
| 251 | case XOOPS_MATCH_EQUAL: |
|---|
| 252 | $criteria->add(new Criteria('user_yim', $myts->addSlashes(trim($_POST['user_yim'])))); |
|---|
| 253 | break; |
|---|
| 254 | case XOOPS_MATCH_CONTAIN: |
|---|
| 255 | $criteria->add(new Criteria('user_yim', '%'.$myts->addSlashes(trim($_POST['user_yim'])).'%', 'LIKE')); |
|---|
| 256 | break; |
|---|
| 257 | } |
|---|
| 258 | } |
|---|
| 259 | if ( !empty($_POST['user_msnm']) ) { |
|---|
| 260 | $match = (!empty($_POST['user_msnm_match'])) ? intval($_POST['user_msnm_match']) : XOOPS_MATCH_START; |
|---|
| 261 | switch ($match) { |
|---|
| 262 | case XOOPS_MATCH_START: |
|---|
| 263 | $criteria->add(new Criteria('user_msnm', $myts->addSlashes(trim($_POST['user_msnm'])).'%', 'LIKE')); |
|---|
| 264 | break; |
|---|
| 265 | case XOOPS_MATCH_END: |
|---|
| 266 | $criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($_POST['user_msnm'])), 'LIKE')); |
|---|
| 267 | break; |
|---|
| 268 | case XOOPS_MATCH_EQUAL: |
|---|
| 269 | $criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($_POST['user_msnm'])))); |
|---|
| 270 | break; |
|---|
| 271 | case XOOPS_MATCH_CONTAIN: |
|---|
| 272 | $criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($_POST['user_msnm'])).'%', 'LIKE')); |
|---|
| 273 | break; |
|---|
| 274 | } |
|---|
| 275 | } |
|---|
| 276 | if ( !empty($_POST['user_from']) ) { |
|---|
| 277 | $criteria->add(new Criteria('user_from', '%'.$myts->addSlashes(trim($_POST['user_from'])).'%', 'LIKE')); |
|---|
| 278 | } |
|---|
| 279 | if ( !empty($_POST['user_intrest']) ) { |
|---|
| 280 | $criteria->add(new Criteria('user_intrest', '%'.$myts->addSlashes(trim($_POST['user_intrest'])).'%', 'LIKE')); |
|---|
| 281 | } |
|---|
| 282 | if ( !empty($_POST['user_occ']) ) { |
|---|
| 283 | $criteria->add(new Criteria('user_occ', '%'.$myts->addSlashes(trim($_POST['user_occ'])).'%', 'LIKE')); |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | if ( !empty($_POST['user_lastlog_more']) && is_numeric($_POST['user_lastlog_more']) ) { |
|---|
| 287 | $f_user_lastlog_more = intval(trim($_POST['user_lastlog_more'])); |
|---|
| 288 | $time = time() - (60 * 60 * 24 * $f_user_lastlog_more); |
|---|
| 289 | if ( $time > 0 ) { |
|---|
| 290 | $criteria->add(new Criteria('last_login', $time, '<')); |
|---|
| 291 | } |
|---|
| 292 | } |
|---|
| 293 | if ( !empty($_POST['user_lastlog_less']) && is_numeric($_POST['user_lastlog_less']) ) { |
|---|
| 294 | $f_user_lastlog_less = intval(trim($_POST['user_lastlog_less'])); |
|---|
| 295 | $time = time() - (60 * 60 * 24 * $f_user_lastlog_less); |
|---|
| 296 | if ( $time > 0 ) { |
|---|
| 297 | $criteria->add(new Criteria('last_login', $time, '>')); |
|---|
| 298 | } |
|---|
| 299 | } |
|---|
| 300 | if ( !empty($_POST['user_reg_more']) && is_numeric($_POST['user_reg_more']) ) { |
|---|
| 301 | $f_user_reg_more = intval(trim($_POST['user_reg_more'])); |
|---|
| 302 | $time = time() - (60 * 60 * 24 * $f_user_reg_more); |
|---|
| 303 | if ( $time > 0 ) { |
|---|
| 304 | $criteria->add(new Criteria('user_regdate', $time, '<')); |
|---|
| 305 | } |
|---|
| 306 | } |
|---|
| 307 | if ( !empty($_POST['user_reg_less']) && is_numeric($_POST['user_reg_less']) ) { |
|---|
| 308 | $f_user_reg_less = intval($_POST['user_reg_less']); |
|---|
| 309 | $time = time() - (60 * 60 * 24 * $f_user_reg_less); |
|---|
| 310 | if ( $time > 0 ) { |
|---|
| 311 | $criteria->add(new Criteria('user_regdate', $time, '>')); |
|---|
| 312 | } |
|---|
| 313 | } |
|---|
| 314 | if ( !empty($_POST['user_posts_more']) && is_numeric($_POST['user_posts_more']) ) { |
|---|
| 315 | $criteria->add(new Criteria('posts', intval($_POST['user_posts_more']), '>')); |
|---|
| 316 | } |
|---|
| 317 | if ( !empty($_POST['user_posts_less']) && is_numeric($_POST['user_posts_less']) ) { |
|---|
| 318 | $criteria->add(new Criteria('posts', intval($_POST['user_posts_less']), '<')); |
|---|
| 319 | } |
|---|
| 320 | if ( isset($_POST['user_mailok']) ) { |
|---|
| 321 | if ( $_POST['user_mailok'] == "mailng" ) { |
|---|
| 322 | $criteria->add(new Criteria('user_mailok', 0)); |
|---|
| 323 | } elseif ( $_POST['user_mailok'] == "mailok" ) { |
|---|
| 324 | $criteria->add(new Criteria('user_mailok', 1)); |
|---|
| 325 | } else { |
|---|
| 326 | $criteria->add(new Criteria('user_mailok', 0, '>=')); |
|---|
| 327 | } |
|---|
| 328 | } |
|---|
| 329 | if ( isset($_POST['user_type']) ) { |
|---|
| 330 | if ( $_POST['user_type'] == "inactv" ) { |
|---|
| 331 | $criteria->add(new Criteria('level', 0, '=')); |
|---|
| 332 | } elseif ( $_POST['user_type'] == "actv" ) { |
|---|
| 333 | $criteria->add(new Criteria('level', 0, '>')); |
|---|
| 334 | } else { |
|---|
| 335 | $criteria->add(new Criteria('level', 0, '>=')); |
|---|
| 336 | } |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | $validsort = array("uname", "email", "last_login", "user_regdate", "posts"); |
|---|
| 340 | $sort = (!in_array($_POST['user_sort'], $validsort)) ? "uname" : $_POST['user_sort']; |
|---|
| 341 | $order = "ASC"; |
|---|
| 342 | if ( isset($_POST['user_order']) && $_POST['user_order'] == "DESC") { |
|---|
| 343 | $order = "DESC"; |
|---|
| 344 | } |
|---|
| 345 | $limit = (!empty($_POST['limit'])) ? intval($_POST['limit']) : 50; |
|---|
| 346 | if ( $limit == 0 || $limit > 50 ) { |
|---|
| 347 | $limit = 50; |
|---|
| 348 | } |
|---|
| 349 | $start = (!empty($_POST['start'])) ? intval($_POST['start']) : 0; |
|---|
| 350 | $member_handler =& xoops_gethandler('member'); |
|---|
| 351 | $total = $member_handler->getUserCount($criteria); |
|---|
| 352 | echo "<a href='admin.php?fct=findusers&op=form'>". _AM_FINDUS ."</a> <span style='font-weight:bold;'>»»</span> ". _AM_RESULTS."<br /><br />"; |
|---|
| 353 | if ( $total == 0 ) { |
|---|
| 354 | echo "<h4>"._AM_NOFOUND,"</h4>"; |
|---|
| 355 | } elseif ( $start < $total ) { |
|---|
| 356 | echo sprintf(_AM_USERSFOUND, $total)."<br />"; |
|---|
| 357 | echo "<form action='admin.php' method='post' name='memberslist' id='memberslist'><input type='hidden' name='op' value='delete_many' /> |
|---|
| 358 | <table width='100%' border='0' cellspacing='1' cellpadding='4' class='outer'><tr><th align='center'><input type='checkbox' name='memberslist_checkall' id='memberslist_checkall' onclick='xoopsCheckAll(\"memberslist\", \"memberslist_checkall\");' /></th><th align='center'>"._AM_AVATAR."</th><th align='center'>"._AM_UNAME."</th><th align='center'>"._AM_REALNAME."</th><th align='center'>"._AM_EMAIL."</th><th align='center'>"._AM_PM."</th><th align='center'>"._AM_URL."</th><th align='center'>"._AM_REGDATE."</th><th align='center'>"._AM_LASTLOGIN."</th><th align='center'>"._AM_POSTS."</th><th align='center'> </th></tr>"; |
|---|
| 359 | $criteria->setSort($sort); |
|---|
| 360 | $criteria->setOrder($order); |
|---|
| 361 | $criteria->setLimit($limit); |
|---|
| 362 | $criteria->setStart($start); |
|---|
| 363 | $foundusers = $member_handler->getUsers($criteria, true); |
|---|
| 364 | $ucount = 0; |
|---|
| 365 | foreach (array_keys($foundusers) as $j) { |
|---|
| 366 | if ($ucount % 2 == 0) { |
|---|
| 367 | $class = 'even'; |
|---|
| 368 | } else { |
|---|
| 369 | $class = 'odd'; |
|---|
| 370 | } |
|---|
| 371 | $ucount++; |
|---|
| 372 | $fuser_avatar = $foundusers[$j]->getVar("user_avatar") ? "<img src='".XOOPS_UPLOAD_URL."/".$foundusers[$j]->getVar("user_avatar")."' alt='' />" : " "; |
|---|
| 373 | $fuser_name = $foundusers[$j]->getVar("name") ? $foundusers[$j]->getVar("name") : " "; |
|---|
| 374 | echo "<tr class='$class'><td align='center'><input type='checkbox' name='memberslist_id[]' id='memberslist_id[]' value='".$foundusers[$j]->getVar("uid")."' /><input type='hidden' name='memberslist_uname[".$foundusers[$j]->getVar("uid")."]' id='memberslist_uname[".$foundusers[$j]->getVar("uid")."]' value='".$foundusers[$j]->getVar("uname")."' /></td>"; |
|---|
| 375 | echo "<td>$fuser_avatar</td><td><a href='".XOOPS_URL."/userinfo.php?uid=".$foundusers[$j]->getVar("uid")."'>".$foundusers[$j]->getVar("uname")."</a></td><td>".$fuser_name."</td><td align='center'><a href='mailto:".$foundusers[$j]->getVar("email")."'><img src='".XOOPS_URL."/images/icons/email.gif' border='0' alt='"; |
|---|
| 376 | printf(_SENDEMAILTO,$foundusers[$j]->getVar("uname", "E")); |
|---|
| 377 | echo "' /></a></td><td align='center'><a href='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send2=1&to_userid=".$foundusers[$j]->getVar("uid")."\",\"pmlite\",450,370);'><img src='".XOOPS_URL."/images/icons/pm.gif' border='0' alt='"; |
|---|
| 378 | printf(_SENDPMTO,$foundusers[$j]->getVar("uname", "E")); |
|---|
| 379 | echo "' /></a></td><td align='center'>"; |
|---|
| 380 | if ( $foundusers[$j]->getVar("url","E") != "" ) { |
|---|
| 381 | echo "<a href='".$foundusers[$j]->getVar("url","E")."' target='_blank'><img src='".XOOPS_URL."/images/icons/www.gif' border='0' alt='"._VISITWEBSITE."' /></a>"; |
|---|
| 382 | } else { |
|---|
| 383 | echo " "; |
|---|
| 384 | } |
|---|
| 385 | echo "</td><td align='center'>".formatTimeStamp($foundusers[$j]->getVar("user_regdate"),"s")."</td><td align='center'>"; |
|---|
| 386 | if ( $foundusers[$j]->getVar("last_login") != 0 ) { |
|---|
| 387 | echo formatTimeStamp($foundusers[$j]->getVar("last_login"),"m"); |
|---|
| 388 | } else { |
|---|
| 389 | echo " "; |
|---|
| 390 | } |
|---|
| 391 | echo "</td><td align='center'>".$foundusers[$j]->getVar("posts")."</td>"; |
|---|
| 392 | echo "<td align='center'><a href='".XOOPS_URL."/modules/system/admin.php?fct=users&uid=".$foundusers[$j]->getVar("uid")."&op=modifyUser'>"._EDIT."</a></td></tr>\n"; |
|---|
| 393 | } |
|---|
| 394 | echo "<tr class='foot'><td><select name='fct'><option value='users'>"._DELETE."</option><option value='mailusers'>"._AM_SENDMAIL."</option>"; |
|---|
| 395 | $group = !empty($_POST['group']) ? intval($_POST['group']) : 0; |
|---|
| 396 | if ( $group > 0 ) { |
|---|
| 397 | // token required for add-user-to-group operation |
|---|
| 398 | $token =& XoopsMultiTokenHandler::quickCreate('groups_User'); |
|---|
| 399 | $member_handler =& xoops_gethandler('member'); |
|---|
| 400 | $add2group =& $member_handler->getGroup($group); |
|---|
| 401 | echo "<option value='groups' selected='selected'>".sprintf(_AM_ADD2GROUP, $add2group->getVar('name'))."</option>"; |
|---|
| 402 | } |
|---|
| 403 | echo "</select> "; |
|---|
| 404 | if (!empty($token) && is_object($token)) { |
|---|
| 405 | echo $token->getHtml(); |
|---|
| 406 | } |
|---|
| 407 | if ( $group > 0 ) { |
|---|
| 408 | echo "<input type='hidden' name='groupid' value='".$group."' />"; |
|---|
| 409 | } |
|---|
| 410 | echo "</td><td colspan='10'><input type='submit' value='"._SUBMIT."' /></td></tr></table></form>\n"; |
|---|
| 411 | $totalpages = ceil($total / $limit); |
|---|
| 412 | if ( $totalpages > 1 ) { |
|---|
| 413 | $hiddenform = "<form name='findnext' action='admin.php' method='post'><input type='hidden' name='op' value='findusers' />"; |
|---|
| 414 | foreach ( $_POST as $k => $v ) { |
|---|
| 415 | $hiddenform .= "<input type='hidden' name='".$myts->htmlSpecialChars($k)."' value='".$myts->htmlSpecialChars($myts->stripSlashesGPC($v))."' />\n"; |
|---|
| 416 | } |
|---|
| 417 | if (!isset($_POST['limit'])) { |
|---|
| 418 | $hiddenform .= "<input type='hidden' name='limit' value='".$limit."' />\n"; |
|---|
| 419 | } |
|---|
| 420 | if (!isset($_POST['start'])) { |
|---|
| 421 | $hiddenform .= "<input type='hidden' name='start' value='".$start."' />\n"; |
|---|
| 422 | } |
|---|
| 423 | $prev = $start - $limit; |
|---|
| 424 | if ( $start - $limit >= 0 ) { |
|---|
| 425 | $hiddenform .= "<a href='#0' onclick='javascript:document.findnext.start.value=".$prev.";document.findnext.submit();'>"._AM_PREVIOUS."</a> \n"; |
|---|
| 426 | } |
|---|
| 427 | $counter = 1; |
|---|
| 428 | $currentpage = ($start+$limit) / $limit; |
|---|
| 429 | while ( $counter <= $totalpages ) { |
|---|
| 430 | if ( $counter == $currentpage ) { |
|---|
| 431 | $hiddenform .= "<b>".$counter."</b> "; |
|---|
| 432 | } elseif ( ($counter > $currentpage-4 && $counter < $currentpage+4) || $counter == 1 || $counter == $totalpages ) { |
|---|
| 433 | if ( $counter == $totalpages && $currentpage < $totalpages-4 ) { |
|---|
| 434 | $hiddenform .= "... "; |
|---|
| 435 | } |
|---|
| 436 | $hiddenform .= "<a href='#".$counter."' onclick='javascript:document.findnext.start.value=".($counter-1)*$limit.";document.findnext.submit();'>".$counter."</a> "; |
|---|
| 437 | if ( $counter == 1 && $currentpage > 5 ) { |
|---|
| 438 | $hiddenform .= "... "; |
|---|
| 439 | } |
|---|
| 440 | } |
|---|
| 441 | $counter++; |
|---|
| 442 | } |
|---|
| 443 | $next = $start+$limit; |
|---|
| 444 | if ( $total > $next ) { |
|---|
| 445 | $hiddenform .= " <a href='#".$total."' onclick='javascript:document.findnext.start.value=".$next.";document.findnext.submit();'>"._AM_NEXT."</a>\n"; |
|---|
| 446 | } |
|---|
| 447 | $hiddenform .= "</form>"; |
|---|
| 448 | echo "<div style='text-align:center'>".$hiddenform."<br />"; |
|---|
| 449 | printf(_AM_USERSFOUND, $total); |
|---|
| 450 | echo "</div>"; |
|---|
| 451 | } |
|---|
| 452 | } |
|---|
| 453 | } |
|---|
| 454 | //CloseTable(); |
|---|
| 455 | xoops_cp_footer(); |
|---|
| 456 | ?> |
|---|