edit.ctrl.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. load()->func('file');
  9. $dos = array('edit_base', 'edit_modules_tpl', 'edit_account');
  10. $do = in_array($do, $dos) ? $do: 'edit_base';
  11. $_W['page']['title'] = '编辑用户 - 用户管理';
  12. $uid = intval($_GPC['uid']);
  13. $user = user_single($uid);
  14. if (empty($user)) {
  15. itoast('访问错误, 未找到该操作员.', url('user/display'), 'error');
  16. }
  17. $founders = explode(',', $_W['config']['setting']['founder']);
  18. $profile = pdo_get('users_profile', array('uid' => $uid));
  19. if (!empty($profile)) $profile['avatar'] = tomedia($profile['avatar']);
  20. if ($do == 'edit_base') {
  21. $user['last_visit'] = date('Y-m-d H:i:s', $user['lastvisit']);
  22. $user['joindate'] = date('Y-m-d H:i:s', $user['joindate']);
  23. $user['end'] = $user['endtime'] == 0 ? '永久' : date('Y-m-d', $user['endtime']);
  24. $user['endtype'] = $user['endtime'] == 0 ? 1 : 2;
  25. $user['url'] = user_invite_register_url($uid);
  26. $profile = user_detail_formate($profile);
  27. template('user/edit-base');
  28. }
  29. if ($do == 'edit_modules_tpl') {
  30. if ($_W['isajax'] && $_W['ispost']) {
  31. if ($user['status'] == USER_STATUS_CHECK || $user['status'] == USER_STATUS_BAN) {
  32. iajax(-1, '访问错误,该用户未审核或者已被禁用,请先修改用户状态!', '');
  33. }
  34. if (intval($_GPC['groupid']) == $user['groupid']){
  35. iajax(2, '未做更改!');
  36. }
  37. if (!empty($_GPC['type']) && !empty($_GPC['groupid'])) {
  38. $data['uid'] = $uid;
  39. $data[$_GPC['type']] = intval($_GPC['groupid']);
  40. if (user_update($data)) {
  41. $group_info = user_group_detail_info($_GPC['groupid']);
  42. iajax(0, $group_info, '');
  43. } else {
  44. iajax(1, '更改失败!', '');
  45. }
  46. } else {
  47. iajax(-1, '参数错误!', '');
  48. }
  49. }
  50. $groups = user_group();
  51. $group_info = user_group_detail_info($user['groupid']);
  52. template('user/edit-modules-tpl');
  53. }
  54. if ($do == 'edit_account') {
  55. $account_detail = user_account_detail_info($uid);
  56. template('user/edit-account');
  57. }