expire.ctrl.php 2.3 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('setting');
  8. $dos = array('display', 'save_expire', 'change_status', 'setting');
  9. $do = in_array($do, $dos) ? $do : 'display';
  10. $user_expire = setting_load('user_expire');
  11. $user_expire = !empty($user_expire['user_expire']) ? $user_expire['user_expire'] : array();
  12. if ($do == 'display') {
  13. $user_expire['day'] = !empty($user_expire['day']) ? $user_expire['day'] : 1;
  14. $user_expire['status'] = !empty($user_expire['status']) ? $user_expire['status'] : 0;
  15. }
  16. if ($do == 'save_expire') {
  17. $type = safe_gpc_string($_GPC['type']);
  18. if ($type == 'day') {
  19. $user_expire['day'] = !empty($_GPC['day']) ? intval($_GPC['day']) : 1;
  20. $url = url('user/expire');
  21. } elseif ($type == 'notice') {
  22. $user_expire['notice'] = !empty($_GPC['notice']) ? safe_gpc_string($_GPC['notice']) : '';
  23. $url = url('user/expire/setting');
  24. }
  25. $result = setting_save($user_expire, 'user_expire');
  26. if (is_error($result)) {
  27. iajax(-1, '设置失败', $url);
  28. }
  29. iajax(0, '设置成功', $url);
  30. }
  31. if ($do == 'change_status') {
  32. $type = safe_gpc_string($_GPC['type']);
  33. if ($type == 'status') {
  34. $user_expire['status'] = empty($user_expire['status']) ? 1 :0;
  35. $url = url('user/expire');
  36. } elseif ($type == 'status_store_button') {
  37. $user_expire['status_store_button'] = empty($user_expire['status_store_button']) ? 1 :0;
  38. $url = url('user/expire/setting');
  39. } elseif ($type == 'status_store_redirect') {
  40. $user_expire['status_store_redirect'] = empty($user_expire['status_store_redirect']) ? 1 :0;
  41. $url = url('user/expire/setting');
  42. }
  43. $result = setting_save($user_expire, 'user_expire');
  44. if (is_error($result)) {
  45. iajax(-1, '设置失败', $url);
  46. }
  47. iajax(0, '设置成功', $url);
  48. }
  49. if ($do == 'setting') {
  50. $user_expire['notice'] = !empty($user_expire['notice']) ? $user_expire['notice'] : '您的账号已到期,请前往商城购买续费';
  51. $user_expire['status_store_button'] = !empty($user_expire['status_store_button']) ? $user_expire['status_store_button'] : 0;
  52. $user_expire['status_store_redirect'] = !empty($user_expire['status_store_redirect']) ? $user_expire['status_store_redirect'] : 0;
  53. }
  54. template('user/expire');