| @@ 115-328 (lines=214) @@ | ||
| 112 | $xoopsTpl->assign( 'totalmember', $total ); |
|
| 113 | } |
|
| 114 | ||
| 115 | if ( $op == 'submit' ) { |
|
| 116 | $xoopsOption['template_main'] = 'xoopsmembers_searchresults.tpl'; |
|
| 117 | include XOOPS_ROOT_PATH . '/header.php'; |
|
| 118 | ||
| 119 | $iamadmin = $xoopsUserIsAdmin; |
|
| 120 | $myts = &MyTextSanitizer::getInstance(); |
|
| 121 | $criteria = new CriteriaCompo(); |
|
| 122 | ||
| 123 | if ( !empty( $_POST['user_uname'] ) ) { |
|
| 124 | $match = ( !empty( $_POST['user_uname_match'] ) ) ? intval( $_POST['user_uname_match'] ) : XOOPS_MATCH_START; |
|
| 125 | $ret = $myts->addSlashes( trim( $_POST['user_uname'] ) ); |
|
| 126 | xoops_Criteria( $criteria, 'uname', $ret, $match ); |
|
| 127 | } |
|
| 128 | ||
| 129 | if ( !empty( $_POST['user_name'] ) ) { |
|
| 130 | $match = ( !empty( $_POST['user_name_match'] ) ) ? intval( $_POST['user_name_match'] ) : XOOPS_MATCH_START; |
|
| 131 | $ret = $myts->addSlashes( trim( $_POST['user_uname'] ) ); |
|
| 132 | xoops_Criteria( $criteria, 'name', $ret, $match ); |
|
| 133 | } |
|
| 134 | ||
| 135 | if ( !empty( $_POST['user_email'] ) ) { |
|
| 136 | $match = ( !empty( $_POST['user_email_match'] ) ) ? intval( $_POST['user_email_match'] ) : XOOPS_MATCH_START; |
|
| 137 | $ret = $myts->addSlashes( trim( $_POST['user_email'] ) ); |
|
| 138 | xoops_Criteria( $criteria, 'name', $ret, $match ); |
|
| 139 | if ( !$iamadmin ) { |
|
| 140 | $criteria->add( new Criteria( 'user_viewemail', 1 ) ); |
|
| 141 | } |
|
| 142 | } |
|
| 143 | ||
| 144 | if ( !empty( $_POST['user_url'] ) ) { |
|
| 145 | $url = formatURL( trim( $_POST['user_url'] ) ); |
|
| 146 | $criteria->add( new Criteria( 'url', $myts->addSlashes( $url ) . '%', 'LIKE' ) ); |
|
| 147 | } |
|
| 148 | ||
| 149 | if ( !empty( $_POST['user_icq'] ) ) { |
|
| 150 | $match = ( !empty( $_POST['user_icq_match'] ) ) ? intval( $_POST['user_icq_match'] ) : XOOPS_MATCH_START; |
|
| 151 | $ret = $myts->addSlashes( trim( $_POST['user_icq'] ) ); |
|
| 152 | xoops_Criteria( $criteria, 'user_icq', $ret, $match ); |
|
| 153 | } |
|
| 154 | ||
| 155 | if ( !empty( $_POST['user_aim'] ) ) { |
|
| 156 | $match = ( !empty( $_POST['user_aim_match'] ) ) ? intval( $_POST['user_aim_match'] ) : XOOPS_MATCH_START; |
|
| 157 | $ret = $myts->addSlashes( trim( $_POST['user_aim'] ) ); |
|
| 158 | xoops_Criteria( $criteria, 'user_aim', $ret, $match ); |
|
| 159 | } |
|
| 160 | ||
| 161 | if ( !empty( $_POST['user_yim'] ) ) { |
|
| 162 | $match = ( !empty( $_POST['user_yim_match'] ) ) ? intval( $_POST['user_yim_match'] ) : XOOPS_MATCH_START; |
|
| 163 | $ret = $myts->addSlashes( trim( $_POST['user_yim'] ) ); |
|
| 164 | xoops_Criteria( $criteria, 'user_yim', $ret, $match ); |
|
| 165 | } |
|
| 166 | ||
| 167 | if ( !empty( $_POST['user_msnm'] ) ) { |
|
| 168 | $match = ( !empty( $_POST['user_msnm_match'] ) ) ? intval( $_POST['user_msnm_match'] ) : XOOPS_MATCH_START; |
|
| 169 | $ret = $myts->addSlashes( trim( $_POST['user_msnm'] ) ); |
|
| 170 | xoops_Criteria( $criteria, 'user_msnm', $ret, $match ); |
|
| 171 | } |
|
| 172 | ||
| 173 | if ( !empty( $_POST['user_from'] ) ) { |
|
| 174 | $criteria->add( new Criteria( 'user_from', '%' . $myts->addSlashes( trim( $_POST['user_from'] ) ) . '%', 'LIKE' ) ); |
|
| 175 | } |
|
| 176 | ||
| 177 | if ( !empty( $_POST['user_intrest'] ) ) { |
|
| 178 | $criteria->add( new Criteria( 'user_intrest', '%' . $myts->addSlashes( trim( $_POST['user_intrest'] ) ) . '%', 'LIKE' ) ); |
|
| 179 | } |
|
| 180 | ||
| 181 | if ( !empty( $_POST['user_occ'] ) ) { |
|
| 182 | $criteria->add( new Criteria( 'user_occ', '%' . $myts->addSlashes( trim( $_POST['user_occ'] ) ) . '%', 'LIKE' ) ); |
|
| 183 | } |
|
| 184 | ||
| 185 | if ( !empty( $_POST['user_lastlog_more'] ) && is_numeric( $_POST['user_lastlog_more'] ) ) { |
|
| 186 | $f_user_lastlog_more = intval( trim( $_POST['user_lastlog_more'] ) ); |
|
| 187 | $time = time() - ( 60 * 60 * 24 * $f_user_lastlog_more ); |
|
| 188 | if ( $time > 0 ) { |
|
| 189 | $criteria->add( new Criteria( 'last_login', $time, '<' ) ); |
|
| 190 | } |
|
| 191 | } |
|
| 192 | ||
| 193 | if ( !empty( $_POST['user_lastlog_less'] ) && is_numeric( $_POST['user_lastlog_less'] ) ) { |
|
| 194 | $f_user_lastlog_less = intval( trim( $_POST['user_lastlog_less'] ) ); |
|
| 195 | $time = time() - ( 60 * 60 * 24 * $f_user_lastlog_less ); |
|
| 196 | if ( $time > 0 ) { |
|
| 197 | $criteria->add( new Criteria( 'last_login', $time, '>' ) ); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | ||
| 201 | if ( !empty( $_POST['user_reg_more'] ) && is_numeric( $_POST['user_reg_more'] ) ) { |
|
| 202 | $f_user_reg_more = intval( trim( $_POST['user_reg_more'] ) ); |
|
| 203 | $time = time() - ( 60 * 60 * 24 * $f_user_reg_more ); |
|
| 204 | if ( $time > 0 ) { |
|
| 205 | $criteria->add( new Criteria( 'user_regdate', $time, '<' ) ); |
|
| 206 | } |
|
| 207 | } |
|
| 208 | ||
| 209 | if ( !empty( $_POST['user_reg_less'] ) && is_numeric( $_POST['user_reg_less'] ) ) { |
|
| 210 | $f_user_reg_less = intval( $_POST['user_reg_less'] ); |
|
| 211 | $time = time() - ( 60 * 60 * 24 * $f_user_reg_less ); |
|
| 212 | if ( $time > 0 ) { |
|
| 213 | $criteria->add( new Criteria( 'user_regdate', $time, '>' ) ); |
|
| 214 | } |
|
| 215 | } |
|
| 216 | ||
| 217 | if ( isset( $_POST['user_posts_more'] ) && is_numeric( $_POST['user_posts_more'] ) ) { |
|
| 218 | $criteria->add( new Criteria( 'posts', intval( $_POST['user_posts_more'] ), '>' ) ); |
|
| 219 | } |
|
| 220 | ||
| 221 | if ( !empty( $_POST['user_posts_less'] ) && is_numeric( $_POST['user_posts_less'] ) ) { |
|
| 222 | $criteria->add( new Criteria( 'posts', intval( $_POST['user_posts_less'] ), '<' ) ); |
|
| 223 | } |
|
| 224 | ||
| 225 | $criteria->add( new Criteria( 'level', 0, '>' ) ); |
|
| 226 | $validsort = array( 'uname', 'email', 'last_login', 'user_regdate', 'posts' ); |
|
| 227 | $sort = ( !in_array( $_POST['user_sort'], $validsort ) ) ? 'uname' : $_POST['user_sort']; |
|
| 228 | $order = 'ASC'; |
|
| 229 | if ( isset( $_POST['user_order'] ) && $_POST['user_order'] == 'DESC' ) { |
|
| 230 | $order = 'DESC'; |
|
| 231 | } |
|
| 232 | $limit = ( !empty( $_POST['limit'] ) ) ? intval( $_POST['limit'] ) : 20; |
|
| 233 | if ( $limit == 0 || $limit > 50 ) { |
|
| 234 | $limit = 50; |
|
| 235 | } |
|
| 236 | ||
| 237 | $start = ( !empty( $_POST['start'] ) ) ? intval( $_POST['start'] ) : 0; |
|
| 238 | $member_handler = &xoops_gethandler( 'member' ); |
|
| 239 | $total = $member_handler->getUserCount( $criteria ); |
|
| 240 | $xoopsTpl->assign( 'total_found', $total ); |
|
| 241 | ||
| 242 | if ( $total == 0 ) { |
|
| 243 | } elseif ( $start < $total ) { |
|
| 244 | if ( $iamadmin ) { |
|
| 245 | $xoopsTpl->assign( 'is_admin', true ); |
|
| 246 | } |
|
| 247 | $criteria->setSort( $sort ); |
|
| 248 | $criteria->setOrder( $order ); |
|
| 249 | $criteria->setStart( $start ); |
|
| 250 | $criteria->setLimit( $limit ); |
|
| 251 | $foundusers = &$member_handler->getUsers( $criteria, true ); |
|
| 252 | foreach ( array_keys( $foundusers ) as $j ) { |
|
| 253 | $userdata["avatar"] = $foundusers[$j]->getVar( 'user_avatar' ) ? '<img src="' . XOOPS_UPLOAD_URL . '/' . $foundusers[$j]->getVar( 'user_avatar' ) . '" alt="" />' : ' '; |
|
| 254 | $userdata["realname"] = $foundusers[$j]->getVar( 'name' ) ? $foundusers[$j]->getVar( 'name' ) : ' '; |
|
| 255 | $userdata["name"] = $foundusers[$j]->getVar( 'uname' ); |
|
| 256 | $userdata["id"] = $foundusers[$j]->getVar( 'uid' ); |
|
| 257 | if ( $foundusers[$j]->getVar( 'user_viewemail' ) == 1 || $iamadmin ) { |
|
| 258 | $userdata["email"] = '<a href="mailto:' . $foundusers[$j]->getVar( 'email' ) . '"><img src="' . XOOPS_URL . '/images/icons/email.gif" border="0" alt="' . sprintf( _SENDEMAILTO, $foundusers[$j]->getVar( 'uname', "e" ) ) . '" /></a>'; |
|
| 259 | } else { |
|
| 260 | $userdata["email"] = ' '; |
|
| 261 | } |
|
| 262 | if ( $xoopsUser ) { |
|
| 263 | $userdata["pmlink"] = '<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="' . sprintf( _SENDPMTO, $foundusers[$j]->getVar( 'uname', "e" ) ) . '" /></a>'; |
|
| 264 | } else { |
|
| 265 | $userdata["pmlink"] = ' '; |
|
| 266 | } |
|
| 267 | if ( $foundusers[$j]->getVar( 'url', "e" ) != '' ) { |
|
| 268 | $userdata["website"] = '<a href="' . $foundusers[$j]->getVar( 'url', "e" ) . '" target="_blank"><img src="' . XOOPS_URL . '/images/icons/www.gif" border="0" alt="' . _VISITWEBSITE . '" /></a>'; |
|
| 269 | } else { |
|
| 270 | $userdata["website"] = ' '; |
|
| 271 | } |
|
| 272 | $userdata["registerdate"] = formatTimeStamp( $foundusers[$j]->getVar( 'user_regdate' ), 's' ); |
|
| 273 | if ( $foundusers[$j]->getVar( 'last_login' ) != 0 ) { |
|
| 274 | $userdata["lastlogin"] = formatTimeStamp( $foundusers[$j]->getVar( 'last_login' ), "m" ); |
|
| 275 | } else { |
|
| 276 | $userdata["lastlogin"] = ' '; |
|
| 277 | } |
|
| 278 | $userdata["posts"] = $foundusers[$j]->getVar( 'posts' ); |
|
| 279 | if ( $iamadmin ) { |
|
| 280 | $userdata["adminlink"] = '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=users&uid=' . $foundusers[$j]->getVar( 'uid' ) . '&op=users_edit">' . '<img src='. $pathIcon16 .'/edit.png'." alt='" . _EDIT . "' title='" . _EDIT . "' />" |
|
| 281 | ||
| 282 | . '</a> | <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=users&op=users_delete&uid=' . $foundusers[$j]->getVar( 'uid' ) . '">' . '<img src='. $pathIcon16 .'/delete.png'." alt='" . _DELETE . "' title='" . _DELETE . "' />" . '</a>'; |
|
| 283 | } |
|
| 284 | $xoopsTpl->append( "users", $userdata ); |
|
| 285 | } |
|
| 286 | ||
| 287 | $totalpages = ceil( $total / $limit ); |
|
| 288 | if ( $totalpages > 1 ) { |
|
| 289 | $hiddenform = '<form name="findnext" action="index.php" method="post">'; |
|
| 290 | foreach ( $_POST as $k => $v ) { |
|
| 291 | $hiddenform .= '<input type="hidden" name="' . $myts->htmlSpecialChars( $k ) . '" value="' . $myts->previewTarea( $v ) . '" />'; |
|
| 292 | } |
|
| 293 | if ( !isset( $_POST['limit'] ) ) { |
|
| 294 | $hiddenform .= '<input type="hidden" name="limit" value="' . $limit . '" />'; |
|
| 295 | } |
|
| 296 | if ( !isset( $_POST['start'] ) ) { |
|
| 297 | $hiddenform .= '<input type="hidden" name="start" value="' . $start . '" />'; |
|
| 298 | } |
|
| 299 | $prev = $start - $limit; |
|
| 300 | if ( $start - $limit >= 0 ) { |
|
| 301 | $hiddenform .= '<a href="#0" onclick="javascript:document.findnext.start.value=' . $prev . ';document.findnext.submit();">' . _MD_XM_PREVIOUS . '</a> '; |
|
| 302 | } |
|
| 303 | $counter = 1; |
|
| 304 | $currentpage = ( $start + $limit ) / $limit; |
|
| 305 | while ( $counter <= $totalpages ) { |
|
| 306 | if ( $counter == $currentpage ) { |
|
| 307 | $hiddenform .= '<b>' . $counter . '</b> '; |
|
| 308 | } elseif ( ( $counter > $currentpage-4 && $counter < $currentpage + 4 ) || $counter == 1 || $counter == $totalpages ) { |
|
| 309 | if ( $counter == $totalpages && $currentpage < $totalpages-4 ) { |
|
| 310 | $hiddenform .= '... '; |
|
| 311 | } |
|
| 312 | $hiddenform .= '<a href="#' . $counter . '" onclick="javascript:document.findnext.start.value=' . ( $counter-1 ) * $limit . ';document.findnext.submit();">' . $counter . '</a> '; |
|
| 313 | if ( $counter == 1 && $currentpage > 5 ) { |
|
| 314 | $hiddenform .= '... '; |
|
| 315 | } |
|
| 316 | } |
|
| 317 | $counter++; |
|
| 318 | } |
|
| 319 | $next = $start + $limit; |
|
| 320 | if ( $total > $next ) { |
|
| 321 | $hiddenform .= ' <a href="#' . $total . '" onclick="javascript:document.findnext.start.value=' . $next . ';document.findnext.submit();">' . _MD_XM_NEXT . '</a>'; |
|
| 322 | } |
|
| 323 | $hiddenform .= '</form>'; |
|
| 324 | $xoopsTpl->assign( 'pagenav', $hiddenform ); |
|
| 325 | $xoopsTpl->assign( 'lang_numfound', sprintf( _MD_XM_USERSFOUND, $total ) ); |
|
| 326 | } |
|
| 327 | } |
|
| 328 | } |
|
| 329 | ||
| 330 | include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
| 331 | exit(); |
|
| @@ 115-328 (lines=214) @@ | ||
| 112 | $xoopsTpl->assign( 'totalmember', $total ); |
|
| 113 | } |
|
| 114 | ||
| 115 | if ( $op == 'submit' ) { |
|
| 116 | $xoopsOption['template_main'] = 'xoopsmembers_searchresults.tpl'; |
|
| 117 | include XOOPS_ROOT_PATH . '/header.php'; |
|
| 118 | ||
| 119 | $iamadmin = $xoopsUserIsAdmin; |
|
| 120 | $myts = &MyTextSanitizer::getInstance(); |
|
| 121 | $criteria = new CriteriaCompo(); |
|
| 122 | ||
| 123 | if ( !empty( $_POST['user_uname'] ) ) { |
|
| 124 | $match = ( !empty( $_POST['user_uname_match'] ) ) ? intval( $_POST['user_uname_match'] ) : XOOPS_MATCH_START; |
|
| 125 | $ret = $myts->addSlashes( trim( $_POST['user_uname'] ) ); |
|
| 126 | xoops_Criteria( $criteria, 'uname', $ret, $match ); |
|
| 127 | } |
|
| 128 | ||
| 129 | if ( !empty( $_POST['user_name'] ) ) { |
|
| 130 | $match = ( !empty( $_POST['user_name_match'] ) ) ? intval( $_POST['user_name_match'] ) : XOOPS_MATCH_START; |
|
| 131 | $ret = $myts->addSlashes( trim( $_POST['user_uname'] ) ); |
|
| 132 | xoops_Criteria( $criteria, 'name', $ret, $match ); |
|
| 133 | } |
|
| 134 | ||
| 135 | if ( !empty( $_POST['user_email'] ) ) { |
|
| 136 | $match = ( !empty( $_POST['user_email_match'] ) ) ? intval( $_POST['user_email_match'] ) : XOOPS_MATCH_START; |
|
| 137 | $ret = $myts->addSlashes( trim( $_POST['user_email'] ) ); |
|
| 138 | xoops_Criteria( $criteria, 'name', $ret, $match ); |
|
| 139 | if ( !$iamadmin ) { |
|
| 140 | $criteria->add( new Criteria( 'user_viewemail', 1 ) ); |
|
| 141 | } |
|
| 142 | } |
|
| 143 | ||
| 144 | if ( !empty( $_POST['user_url'] ) ) { |
|
| 145 | $url = formatURL( trim( $_POST['user_url'] ) ); |
|
| 146 | $criteria->add( new Criteria( 'url', $myts->addSlashes( $url ) . '%', 'LIKE' ) ); |
|
| 147 | } |
|
| 148 | ||
| 149 | if ( !empty( $_POST['user_icq'] ) ) { |
|
| 150 | $match = ( !empty( $_POST['user_icq_match'] ) ) ? intval( $_POST['user_icq_match'] ) : XOOPS_MATCH_START; |
|
| 151 | $ret = $myts->addSlashes( trim( $_POST['user_icq'] ) ); |
|
| 152 | xoops_Criteria( $criteria, 'user_icq', $ret, $match ); |
|
| 153 | } |
|
| 154 | ||
| 155 | if ( !empty( $_POST['user_aim'] ) ) { |
|
| 156 | $match = ( !empty( $_POST['user_aim_match'] ) ) ? intval( $_POST['user_aim_match'] ) : XOOPS_MATCH_START; |
|
| 157 | $ret = $myts->addSlashes( trim( $_POST['user_aim'] ) ); |
|
| 158 | xoops_Criteria( $criteria, 'user_aim', $ret, $match ); |
|
| 159 | } |
|
| 160 | ||
| 161 | if ( !empty( $_POST['user_yim'] ) ) { |
|
| 162 | $match = ( !empty( $_POST['user_yim_match'] ) ) ? intval( $_POST['user_yim_match'] ) : XOOPS_MATCH_START; |
|
| 163 | $ret = $myts->addSlashes( trim( $_POST['user_yim'] ) ); |
|
| 164 | xoops_Criteria( $criteria, 'user_yim', $ret, $match ); |
|
| 165 | } |
|
| 166 | ||
| 167 | if ( !empty( $_POST['user_msnm'] ) ) { |
|
| 168 | $match = ( !empty( $_POST['user_msnm_match'] ) ) ? intval( $_POST['user_msnm_match'] ) : XOOPS_MATCH_START; |
|
| 169 | $ret = $myts->addSlashes( trim( $_POST['user_msnm'] ) ); |
|
| 170 | xoops_Criteria( $criteria, 'user_msnm', $ret, $match ); |
|
| 171 | } |
|
| 172 | ||
| 173 | if ( !empty( $_POST['user_from'] ) ) { |
|
| 174 | $criteria->add( new Criteria( 'user_from', '%' . $myts->addSlashes( trim( $_POST['user_from'] ) ) . '%', 'LIKE' ) ); |
|
| 175 | } |
|
| 176 | ||
| 177 | if ( !empty( $_POST['user_intrest'] ) ) { |
|
| 178 | $criteria->add( new Criteria( 'user_intrest', '%' . $myts->addSlashes( trim( $_POST['user_intrest'] ) ) . '%', 'LIKE' ) ); |
|
| 179 | } |
|
| 180 | ||
| 181 | if ( !empty( $_POST['user_occ'] ) ) { |
|
| 182 | $criteria->add( new Criteria( 'user_occ', '%' . $myts->addSlashes( trim( $_POST['user_occ'] ) ) . '%', 'LIKE' ) ); |
|
| 183 | } |
|
| 184 | ||
| 185 | if ( !empty( $_POST['user_lastlog_more'] ) && is_numeric( $_POST['user_lastlog_more'] ) ) { |
|
| 186 | $f_user_lastlog_more = intval( trim( $_POST['user_lastlog_more'] ) ); |
|
| 187 | $time = time() - ( 60 * 60 * 24 * $f_user_lastlog_more ); |
|
| 188 | if ( $time > 0 ) { |
|
| 189 | $criteria->add( new Criteria( 'last_login', $time, '<' ) ); |
|
| 190 | } |
|
| 191 | } |
|
| 192 | ||
| 193 | if ( !empty( $_POST['user_lastlog_less'] ) && is_numeric( $_POST['user_lastlog_less'] ) ) { |
|
| 194 | $f_user_lastlog_less = intval( trim( $_POST['user_lastlog_less'] ) ); |
|
| 195 | $time = time() - ( 60 * 60 * 24 * $f_user_lastlog_less ); |
|
| 196 | if ( $time > 0 ) { |
|
| 197 | $criteria->add( new Criteria( 'last_login', $time, '>' ) ); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | ||
| 201 | if ( !empty( $_POST['user_reg_more'] ) && is_numeric( $_POST['user_reg_more'] ) ) { |
|
| 202 | $f_user_reg_more = intval( trim( $_POST['user_reg_more'] ) ); |
|
| 203 | $time = time() - ( 60 * 60 * 24 * $f_user_reg_more ); |
|
| 204 | if ( $time > 0 ) { |
|
| 205 | $criteria->add( new Criteria( 'user_regdate', $time, '<' ) ); |
|
| 206 | } |
|
| 207 | } |
|
| 208 | ||
| 209 | if ( !empty( $_POST['user_reg_less'] ) && is_numeric( $_POST['user_reg_less'] ) ) { |
|
| 210 | $f_user_reg_less = intval( $_POST['user_reg_less'] ); |
|
| 211 | $time = time() - ( 60 * 60 * 24 * $f_user_reg_less ); |
|
| 212 | if ( $time > 0 ) { |
|
| 213 | $criteria->add( new Criteria( 'user_regdate', $time, '>' ) ); |
|
| 214 | } |
|
| 215 | } |
|
| 216 | ||
| 217 | if ( isset( $_POST['user_posts_more'] ) && is_numeric( $_POST['user_posts_more'] ) ) { |
|
| 218 | $criteria->add( new Criteria( 'posts', intval( $_POST['user_posts_more'] ), '>' ) ); |
|
| 219 | } |
|
| 220 | ||
| 221 | if ( !empty( $_POST['user_posts_less'] ) && is_numeric( $_POST['user_posts_less'] ) ) { |
|
| 222 | $criteria->add( new Criteria( 'posts', intval( $_POST['user_posts_less'] ), '<' ) ); |
|
| 223 | } |
|
| 224 | ||
| 225 | $criteria->add( new Criteria( 'level', 0, '>' ) ); |
|
| 226 | $validsort = array( 'uname', 'email', 'last_login', 'user_regdate', 'posts' ); |
|
| 227 | $sort = ( !in_array( $_POST['user_sort'], $validsort ) ) ? 'uname' : $_POST['user_sort']; |
|
| 228 | $order = 'ASC'; |
|
| 229 | if ( isset( $_POST['user_order'] ) && $_POST['user_order'] == 'DESC' ) { |
|
| 230 | $order = 'DESC'; |
|
| 231 | } |
|
| 232 | $limit = ( !empty( $_POST['limit'] ) ) ? intval( $_POST['limit'] ) : 20; |
|
| 233 | if ( $limit == 0 || $limit > 50 ) { |
|
| 234 | $limit = 50; |
|
| 235 | } |
|
| 236 | ||
| 237 | $start = ( !empty( $_POST['start'] ) ) ? intval( $_POST['start'] ) : 0; |
|
| 238 | $member_handler = &xoops_gethandler( 'member' ); |
|
| 239 | $total = $member_handler->getUserCount( $criteria ); |
|
| 240 | $xoopsTpl->assign( 'total_found', $total ); |
|
| 241 | ||
| 242 | if ( $total == 0 ) { |
|
| 243 | } elseif ( $start < $total ) { |
|
| 244 | if ( $iamadmin ) { |
|
| 245 | $xoopsTpl->assign( 'is_admin', true ); |
|
| 246 | } |
|
| 247 | $criteria->setSort( $sort ); |
|
| 248 | $criteria->setOrder( $order ); |
|
| 249 | $criteria->setStart( $start ); |
|
| 250 | $criteria->setLimit( $limit ); |
|
| 251 | $foundusers = &$member_handler->getUsers( $criteria, true ); |
|
| 252 | foreach ( array_keys( $foundusers ) as $j ) { |
|
| 253 | $userdata["avatar"] = $foundusers[$j]->getVar( 'user_avatar' ) ? '<img src="' . XOOPS_UPLOAD_URL . '/' . $foundusers[$j]->getVar( 'user_avatar' ) . '" alt="" />' : ' '; |
|
| 254 | $userdata["realname"] = $foundusers[$j]->getVar( 'name' ) ? $foundusers[$j]->getVar( 'name' ) : ' '; |
|
| 255 | $userdata["name"] = $foundusers[$j]->getVar( 'uname' ); |
|
| 256 | $userdata["id"] = $foundusers[$j]->getVar( 'uid' ); |
|
| 257 | if ( $foundusers[$j]->getVar( 'user_viewemail' ) == 1 || $iamadmin ) { |
|
| 258 | $userdata["email"] = '<a href="mailto:' . $foundusers[$j]->getVar( 'email' ) . '"><img src="' . XOOPS_URL . '/images/icons/email.gif" border="0" alt="' . sprintf( _SENDEMAILTO, $foundusers[$j]->getVar( 'uname', "e" ) ) . '" /></a>'; |
|
| 259 | } else { |
|
| 260 | $userdata["email"] = ' '; |
|
| 261 | } |
|
| 262 | if ( $xoopsUser ) { |
|
| 263 | $userdata["pmlink"] = '<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="' . sprintf( _SENDPMTO, $foundusers[$j]->getVar( 'uname', "e" ) ) . '" /></a>'; |
|
| 264 | } else { |
|
| 265 | $userdata["pmlink"] = ' '; |
|
| 266 | } |
|
| 267 | if ( $foundusers[$j]->getVar( 'url', "e" ) != '' ) { |
|
| 268 | $userdata["website"] = '<a href="' . $foundusers[$j]->getVar( 'url', "e" ) . '" target="_blank"><img src="' . XOOPS_URL . '/images/icons/www.gif" border="0" alt="' . _VISITWEBSITE . '" /></a>'; |
|
| 269 | } else { |
|
| 270 | $userdata["website"] = ' '; |
|
| 271 | } |
|
| 272 | $userdata["registerdate"] = formatTimeStamp( $foundusers[$j]->getVar( 'user_regdate' ), 's' ); |
|
| 273 | if ( $foundusers[$j]->getVar( 'last_login' ) != 0 ) { |
|
| 274 | $userdata["lastlogin"] = formatTimeStamp( $foundusers[$j]->getVar( 'last_login' ), "m" ); |
|
| 275 | } else { |
|
| 276 | $userdata["lastlogin"] = ' '; |
|
| 277 | } |
|
| 278 | $userdata["posts"] = $foundusers[$j]->getVar( 'posts' ); |
|
| 279 | if ( $iamadmin ) { |
|
| 280 | $userdata["adminlink"] = '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=users&uid=' . $foundusers[$j]->getVar( 'uid' ) . '&op=users_edit">' . '<img src='. $pathIcon16 .'/edit.png'." alt='" . _EDIT . "' title='" . _EDIT . "' />" |
|
| 281 | ||
| 282 | . '</a> | <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=users&op=users_delete&uid=' . $foundusers[$j]->getVar( 'uid' ) . '">' . '<img src='. $pathIcon16 .'/delete.png'." alt='" . _DELETE . "' title='" . _DELETE . "' />" . '</a>'; |
|
| 283 | } |
|
| 284 | $xoopsTpl->append( "users", $userdata ); |
|
| 285 | } |
|
| 286 | ||
| 287 | $totalpages = ceil( $total / $limit ); |
|
| 288 | if ( $totalpages > 1 ) { |
|
| 289 | $hiddenform = '<form name="findnext" action="index.php" method="post">'; |
|
| 290 | foreach ( $_POST as $k => $v ) { |
|
| 291 | $hiddenform .= '<input type="hidden" name="' . $myts->htmlSpecialChars( $k ) . '" value="' . $myts->previewTarea( $v ) . '" />'; |
|
| 292 | } |
|
| 293 | if ( !isset( $_POST['limit'] ) ) { |
|
| 294 | $hiddenform .= '<input type="hidden" name="limit" value="' . $limit . '" />'; |
|
| 295 | } |
|
| 296 | if ( !isset( $_POST['start'] ) ) { |
|
| 297 | $hiddenform .= '<input type="hidden" name="start" value="' . $start . '" />'; |
|
| 298 | } |
|
| 299 | $prev = $start - $limit; |
|
| 300 | if ( $start - $limit >= 0 ) { |
|
| 301 | $hiddenform .= '<a href="#0" onclick="javascript:document.findnext.start.value=' . $prev . ';document.findnext.submit();">' . _MD_XM_PREVIOUS . '</a> '; |
|
| 302 | } |
|
| 303 | $counter = 1; |
|
| 304 | $currentpage = ( $start + $limit ) / $limit; |
|
| 305 | while ( $counter <= $totalpages ) { |
|
| 306 | if ( $counter == $currentpage ) { |
|
| 307 | $hiddenform .= '<b>' . $counter . '</b> '; |
|
| 308 | } elseif ( ( $counter > $currentpage-4 && $counter < $currentpage + 4 ) || $counter == 1 || $counter == $totalpages ) { |
|
| 309 | if ( $counter == $totalpages && $currentpage < $totalpages-4 ) { |
|
| 310 | $hiddenform .= '... '; |
|
| 311 | } |
|
| 312 | $hiddenform .= '<a href="#' . $counter . '" onclick="javascript:document.findnext.start.value=' . ( $counter-1 ) * $limit . ';document.findnext.submit();">' . $counter . '</a> '; |
|
| 313 | if ( $counter == 1 && $currentpage > 5 ) { |
|
| 314 | $hiddenform .= '... '; |
|
| 315 | } |
|
| 316 | } |
|
| 317 | $counter++; |
|
| 318 | } |
|
| 319 | $next = $start + $limit; |
|
| 320 | if ( $total > $next ) { |
|
| 321 | $hiddenform .= ' <a href="#' . $total . '" onclick="javascript:document.findnext.start.value=' . $next . ';document.findnext.submit();">' . _MD_XM_NEXT . '</a>'; |
|
| 322 | } |
|
| 323 | $hiddenform .= '</form>'; |
|
| 324 | $xoopsTpl->assign( 'pagenav', $hiddenform ); |
|
| 325 | $xoopsTpl->assign( 'lang_numfound', sprintf( _MD_XM_USERSFOUND, $total ) ); |
|
| 326 | } |
|
| 327 | } |
|
| 328 | } |
|
| 329 | ||
| 330 | include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
| 331 | exit(); |
|