You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.4 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <?php
  2. /*
  3. * @copyright Leyun internet Technology(Shanghai)Co.,Ltd
  4. * @license http://www.dzzoffice.com/licenses/license.txt
  5. * @package DzzOffice
  6. * @link http://www.dzzoffice.com
  7. * @author zyx(zyx@dzz.cc)
  8. */
  9. if (!defined('IN_DZZ')) {
  10. exit('Access Denied');
  11. }
  12. define('NOROBOT', TRUE);
  13. if ($_GET['action'] == 'checkusername') {
  14. $username = isset($_GET['username']) ? trim($_GET['username']) : '';
  15. $usernamelen = dstrlen($username);
  16. if ($usernamelen < 3) {
  17. showTips(array('error' => lang('profile_nickname_tooshort')));
  18. } elseif ($usernamelen > 30) {
  19. showTips(array('error' => lang('profile_nickname_toolong')));
  20. }
  21. require_once libfile('function/user');
  22. $ucresult = uc_user_checkname($username);
  23. if ($ucresult == -1) {
  24. showTips(array('error' => lang('profile_nickname_illegal')));
  25. } elseif ($ucresult == -2) {
  26. showTips(array('error' => lang('profile_nickname_protect')));
  27. } elseif ($ucresult == -3) {
  28. showTips(array('error' => lang('register_check_found')));
  29. }
  30. $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($_G['setting']['censoruser'] = trim($_G['setting']['censoruser'])), '/')) . ')$/i';
  31. if ($_G['setting']['censoruser'] && @preg_match($censorexp, $username)) {
  32. showTips(array('error' => lang('profile_nickname_protect')));
  33. }
  34. } elseif ($_GET['action'] == 'checkemail') {
  35. require_once libfile('function/user');
  36. checkemail($_GET['email']);
  37. } elseif ($_GET['action'] == 'checkuserexists') {
  38. if (C::t('user')->fetch_by_username(trim($_GET['username']))) {
  39. showmessage('<img src="' . $_G['style']['imgdir'] . '/check_right.gif" width="13" height="13">', '', array(), array('msgtype' => 3));
  40. } else {
  41. showmessage('username_nonexistence', '', array(), array('msgtype' => 3));
  42. }
  43. } elseif ($_GET['action'] == 'district') {
  44. $container = $_GET['container'];
  45. $showlevel = intval($_GET['level']);
  46. $showlevel = $showlevel >= 1 && $showlevel <= 4 ? $showlevel : 4;
  47. $values = array(intval($_GET['pid']), intval($_GET['cid']), intval($_GET['did']), intval($_GET['coid']));
  48. $containertype = in_array($_GET['containertype'], array('birth', 'reside'), true) ? $_GET['containertype'] : 'birth';
  49. $level = 1;
  50. if ($values[0]) {
  51. $level++;
  52. } else if ($_G['uid'] && !empty($_GET['showdefault'])) {
  53. space_merge($_G['member'], 'profile');
  54. $district = array();
  55. if ($containertype == 'birth') {
  56. if (!empty($_G['member']['birthprovince'])) {
  57. $district[] = $_G['member']['birthprovince'];
  58. if (!empty($_G['member']['birthcity'])) {
  59. $district[] = $_G['member']['birthcity'];
  60. }
  61. if (!empty($_G['member']['birthdist'])) {
  62. $district[] = $_G['member']['birthdist'];
  63. }
  64. if (!empty($_G['member']['birthcommunity'])) {
  65. $district[] = $_G['member']['birthcommunity'];
  66. }
  67. }
  68. } else {
  69. if (!empty($_G['member']['resideprovince'])) {
  70. $district[] = $_G['member']['resideprovince'];
  71. if (!empty($_G['member']['residecity'])) {
  72. $district[] = $_G['member']['residecity'];
  73. }
  74. if (!empty($_G['member']['residedist'])) {
  75. $district[] = $_G['member']['residedist'];
  76. }
  77. if (!empty($_G['member']['residecommunity'])) {
  78. $district[] = $_G['member']['residecommunity'];
  79. }
  80. }
  81. }
  82. if (!empty($district)) {
  83. foreach (C::t('district')->fetch_all_by_name($district) as $value) {
  84. $key = $value['level'] - 1;
  85. $values[$key] = $value['id'];
  86. }
  87. $level++;
  88. }
  89. }
  90. if ($values[1]) {
  91. $level++;
  92. }
  93. if ($values[2]) {
  94. $level++;
  95. }
  96. if ($values[3]) {
  97. $level++;
  98. }
  99. $showlevel = $level;
  100. $elems = array();
  101. if ($_GET['province']) {
  102. $elems = array($_GET['province'], $_GET['city'], $_GET['district'], $_GET['community']);
  103. }
  104. include_once libfile('function/profile');
  105. $html = showdistrict($values, $elems, $container, $showlevel, $containertype);
  106. include template('ajax');
  107. exit();
  108. }
  109. showTips(array('msg' => 'success'), $type, $template);