recycle.ctrl.php 2.7 KB

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. $dos = array('display', 'recover', 'delete');
  8. $do = in_array($do, $dos) ? $do : 'display';
  9. if (!in_array($_W['role'], array(ACCOUNT_MANAGE_NAME_OWNER, ACCOUNT_MANAGE_NAME_FOUNDER, ACCOUNT_MANAGE_NAME_VICE_FOUNDER))) {
  10. itoast('无权限操作!', referer(), 'error');
  11. }
  12. if ($do == 'display') {
  13. $pindex = max(1, intval($_GPC['page']));
  14. $psize = 20;
  15. $account_table = table('account');
  16. $account_type = $_GPC['account_type'];
  17. if (!empty($account_type)) {
  18. $account_table->searchWithType($account_all_type_sign[$account_type]['contain_type']);
  19. }
  20. $keyword = trim($_GPC['keyword']);
  21. if (!empty($keyword)) {
  22. $account_table->searchWithKeyword($keyword);
  23. }
  24. $account_table->searchWithPage($pindex, $psize);
  25. $del_accounts = $account_table->searchAccountList(false, 0);
  26. $total = $account_table->getLastQueryTotal();
  27. $pager = pagination($total, $pindex, $psize);
  28. foreach($del_accounts as &$account) {
  29. $account = uni_fetch($account['uniacid']);
  30. $account['end'] = $account['endtime'] == 0 ? '永久' : date('Y-m-d', $account['endtime']);
  31. }
  32. $del_accounts = array_values($del_accounts);
  33. template('account/recycle');
  34. }
  35. if ($do == 'recover' || $do == 'delete') {
  36. $acid = intval($_GPC['acid']);
  37. $uniacid = intval($_GPC['uniacid']);
  38. $state = permission_account_user_role($_W['uid'], $uniacid);
  39. if (!in_array($state, array(ACCOUNT_MANAGE_NAME_FOUNDER, ACCOUNT_MANAGE_NAME_OWNER, ACCOUNT_MANAGE_NAME_VICE_FOUNDER))) {
  40. itoast('没有权限,请联系该平台账号的主管理员或网站创始人进行恢复操作!', referer(), 'error');
  41. }
  42. }
  43. if ($do == 'recover') {
  44. $account_info = permission_user_account_num();
  45. if ($account_info['account_limit'] <= 0 && $_W['role'] != ACCOUNT_MANAGE_NAME_FOUNDER) {
  46. itoast('您所在用户组可添加的平台账号数量已达上限,请停用后再行恢复此平台账号!', referer(), 'error');
  47. }
  48. if (!empty($uniacid)) {
  49. pdo_update('account', array('isdeleted' => 0), array('uniacid' => $uniacid));
  50. cache_delete(cache_system_key('uniaccount', array('uniacid' => $uniacid)));
  51. } else {
  52. pdo_update('account', array('isdeleted' => 0), array('acid' => $acid));
  53. }
  54. itoast('恢复成功', referer(), 'success');
  55. }
  56. if($do == 'delete') {
  57. if (empty($_W['isajax']) || empty($_W['ispost'])) {
  58. iajax(0, '非法操作!', referer());
  59. }
  60. $jobid = account_delete($acid);
  61. if (user_is_founder($_W['uid'], true)) {
  62. $url = url('system/job/display', array('jobid'=>$jobid));
  63. } else {
  64. $url = url('account/recycle', array('account_type' => ACCOUNT_TYPE));
  65. }
  66. iajax(0, '删除成功!', $url);
  67. }