user.ctrl.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('user');
  8. $dos = array('browser');
  9. $do = in_array($do, $dos) ? $do: 'browser';
  10. if ($do == 'browser') {
  11. $mode = empty($_GPC['mode']) ? 'visible' : $_GPC['mode'];
  12. $mode = in_array($mode, array('invisible','visible')) ? $mode : 'visible';
  13. $callback = $_GPC['callback'];
  14. $uids = $_GPC['uids'];
  15. $uidArr = array();
  16. if(empty($uids)){
  17. $uids='';
  18. }else{
  19. foreach (explode(',', $uids) as $uid) {
  20. $uidArr[] = intval($uid);
  21. }
  22. $uids = implode(',', $uidArr);
  23. }
  24. $where = " WHERE status = '2' and type != '".ACCOUNT_OPERATE_CLERK."' AND founder_groupid != " . ACCOUNT_MANAGE_GROUP_VICE_FOUNDER;
  25. if($mode == 'invisible' && !empty($uids)){
  26. $where .= " AND uid not in ( {$uids} )";
  27. }
  28. $params = array();
  29. if(!empty($_GPC['keyword'])) {
  30. $where .= ' AND `username` LIKE :username';
  31. $params[':username'] = "%{$_GPC['keyword']}%";
  32. }
  33. if (user_is_vice_founder()) {
  34. $founder_users = table('users_founder_own_users')->getFounderOwnUsersList($_W['uid']);
  35. if (!empty($founder_users)) {
  36. $founder_users = implode(',', array_keys($founder_users));
  37. $where .= " AND `uid` in ($founder_users)";
  38. }
  39. }
  40. $pindex = max(1, intval($_GPC['page']));
  41. $psize = 10;
  42. $total = 0;
  43. $list = pdo_fetchall("SELECT uid, groupid, username, remark FROM ".tablename('users')." {$where} ORDER BY `uid` LIMIT ".(($pindex - 1) * $psize).",{$psize}", $params);
  44. $total = pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('users'). $where , $params);
  45. $pager = pagination($total, $pindex, $psize, '', array('ajaxcallback'=>'null','mode'=>$mode,'uids'=>$uids));
  46. $usergroups = array();
  47. if (!empty($list)) {
  48. $group_ids = array();
  49. foreach ($list as $item) {
  50. if (!empty($item['groupid']) && !in_array($item['groupid'], $group_ids)) {
  51. $group_ids[] = $item['groupid'];
  52. }
  53. }
  54. if (!empty($group_ids)) {
  55. $usergroups = table('users_group')->getAllById($group_ids);
  56. }
  57. }
  58. template('utility/user-browser');
  59. exit;
  60. }