人人商城

edit.ctrl.php 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. } else {
  17. if ($user['status'] == 1) itoast('访问错误,该用户未审核通过,请先审核通过再修改!', url('user/display/check_display'), 'error');
  18. if ($user['status'] == 3) itoast('访问错误,该用户已被禁用,请先启用再修改!', url('user/display/recycle_display'), 'error');
  19. }
  20. $founders = explode(',', $_W['config']['setting']['founder']);
  21. $profile = pdo_get('users_profile', array('uid' => $uid));
  22. if (!empty($profile)) $profile['avatar'] = tomedia($profile['avatar']);
  23. if ($do == 'edit_base') {
  24. $account_num = permission_user_account_num($uid);
  25. $user['last_visit'] = date('Y-m-d H:i:s', $user['lastvisit']);
  26. $user['end'] = $user['endtime'] == 0 ? '永久' : date('Y-m-d', $user['endtime']);
  27. $user['endtype'] = $user['endtime'] == 0 ? 1 : 2;
  28. $user['url'] = user_invite_register_url($uid);
  29. $user['joindate'] = date('Y-m-d', $user['joindate']);
  30. if (!empty($profile)) {
  31. $profile['reside'] = array(
  32. 'province' => $profile['resideprovince'],
  33. 'city' => $profile['residecity'],
  34. 'district' => $profile['residedist']
  35. );
  36. $profile['birth'] = array(
  37. 'year' => $profile['birthyear'],
  38. 'month' => $profile['birthmonth'],
  39. 'day' => $profile['birthday'],
  40. );
  41. $profile['resides'] = $profile['resideprovince'] . $profile['residecity'] . $profile['residedist'] ;
  42. $profile['births'] =($profile['birthyear'] ? $profile['birthyear'] : '--') . '年' . ($profile['birthmonth'] ? $profile['birthmonth'] : '--') . '月' . ($profile['birthday'] ? $profile['birthday'] : '--') .'日';
  43. }
  44. template('user/edit-base');
  45. }
  46. if ($do == 'edit_modules_tpl') {
  47. if ($_W['isajax'] && $_W['ispost']) {
  48. if (intval($_GPC['groupid']) == $user['groupid']){
  49. iajax(2, '未做更改!');
  50. }
  51. if (!empty($_GPC['type']) && !empty($_GPC['groupid'])) {
  52. $data['uid'] = $uid;
  53. $data[$_GPC['type']] = intval($_GPC['groupid']);
  54. if (user_update($data)) {
  55. $group_info = user_founder_group_detail_info($_GPC['groupid']);
  56. iajax(0, $group_info, '');
  57. } else {
  58. iajax(1, '更改失败!', '');
  59. }
  60. } else {
  61. iajax(-1, '参数错误!', '');
  62. }
  63. }
  64. $groups = user_founder_group();
  65. $group_info = user_founder_group_detail_info($user['groupid']);
  66. template('founder/edit-modules-tpl');
  67. }
  68. if ($do == 'edit_account') {
  69. $account_detail = user_account_detail_info($uid);
  70. template('user/edit-account');
  71. }