class_member.php 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: class_member.php 34156 2013-10-25 01:10:00Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class logging_ctl {
  12. function logging_ctl() {
  13. require_once libfile('function/misc');
  14. loaducenter();
  15. }
  16. function logging_more($questionexist, $secchecklogin2 = 0) {
  17. global $_G;
  18. if(empty($_GET['lssubmit'])) {
  19. return;
  20. }
  21. $auth = authcode($_GET['username']."\t".$_GET['password']."\t".($questionexist ? 1 : 0), 'ENCODE', $_G['config']['security']['authkey']);
  22. $js = '<script type="text/javascript">showWindow(\'login\', \'member.php?mod=logging&action=login&auth='.rawurlencode($auth).'&referer='.rawurlencode(dreferer()).(!empty($_GET['cookietime']) ? '&cookietime=1' : '').'\')</script>';
  23. showmessage('location_login', '', array('type' => 1), array('extrajs' => $js));
  24. }
  25. function on_login() {
  26. global $_G;
  27. if($_G['uid']) {
  28. $referer = dreferer();
  29. $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
  30. $param = array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['member']['uid']);
  31. showmessage('login_succeed', $referer ? $referer : './', $param, array('showdialog' => 1, 'locationtime' => true, 'extrajs' => $ucsynlogin));
  32. }
  33. list($seccodecheck) = seccheck('login');
  34. if(!empty($_GET['auth'])) {
  35. $dauth = authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey']);
  36. list(,,,$secchecklogin2) = explode("\t", $dauth);
  37. if($secchecklogin2) {
  38. $seccodecheck = true;
  39. }
  40. }
  41. $seccodestatus = !empty($_GET['lssubmit']) ? false : $seccodecheck;
  42. $invite = getinvite();
  43. if(!submitcheck('loginsubmit', 1, $seccodestatus)) {
  44. $auth = '';
  45. $username = !empty($_G['cookie']['loginuser']) ? dhtmlspecialchars($_G['cookie']['loginuser']) : '';
  46. if(!empty($_GET['auth'])) {
  47. list($username, $password, $questionexist) = explode("\t", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey']));
  48. $username = dhtmlspecialchars($username);
  49. $auth = dhtmlspecialchars($_GET['auth']);
  50. }
  51. $cookietimecheck = !empty($_G['cookie']['cookietime']) || !empty($_GET['cookietime']) ? 'checked="checked"' : '';
  52. if($seccodecheck) {
  53. $seccode = random(6, 1) + $seccode{0} * 1000000;
  54. }
  55. if($this->extrafile && file_exists($this->extrafile)) {
  56. require_once $this->extrafile;
  57. }
  58. $navtitle = lang('core', 'title_login');
  59. include template($this->template);
  60. } else {
  61. if(!empty($_GET['auth'])) {
  62. list($_GET['username'], $_GET['password']) = daddslashes(explode("\t", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey'])));
  63. }
  64. $loginhash = !empty($_GET['loginhash']) && preg_match('/^\w+$/', $_GET['loginhash']) ? $_GET['loginhash'] : '';
  65. if(!($_G['member_loginperm'] = logincheck($_GET['username']))) {
  66. captcha::report($_G['clientip']);
  67. showmessage('login_strike');
  68. }
  69. if($_GET['fastloginfield']) {
  70. $_GET['loginfield'] = $_GET['fastloginfield'];
  71. }
  72. $_G['uid'] = $_G['member']['uid'] = 0;
  73. $_G['username'] = $_G['member']['username'] = $_G['member']['password'] = '';
  74. if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {
  75. showmessage('profile_passwd_illegal');
  76. }
  77. $result = userlogin($_GET['username'], $_GET['password'], $_GET['questionid'], $_GET['answer'], $this->setting['autoidselect'] ? 'auto' : $_GET['loginfield'], $_G['clientip']);
  78. $uid = $result['ucresult']['uid'];
  79. if(!empty($_GET['lssubmit']) && ($result['ucresult']['uid'] == -3 || $seccodecheck)) {
  80. $_GET['username'] = $result['ucresult']['username'];
  81. $this->logging_more($result['ucresult']['uid'] == -3);
  82. }
  83. if($result['status'] == -1) {
  84. if(!$this->setting['fastactivation']) {
  85. $auth = authcode($result['ucresult']['username']."\t".FORMHASH, 'ENCODE');
  86. showmessage('location_activation', 'member.php?mod='.$this->setting['regname'].'&action=activation&auth='.rawurlencode($auth).'&referer='.rawurlencode(dreferer()), array(), array('location' => true));
  87. } else {
  88. $init_arr = explode(',', $this->setting['initcredits']);
  89. $groupid = $this->setting['regverify'] ? 8 : $this->setting['newusergroupid'];
  90. C::t('common_member')->insert($uid, $result['ucresult']['username'], md5(random(10)), $result['ucresult']['email'], $_G['clientip'], $groupid, $init_arr);
  91. $result['member'] = getuserbyuid($uid);
  92. $result['status'] = 1;
  93. }
  94. }
  95. if($result['status'] > 0) {
  96. if($this->extrafile && file_exists($this->extrafile)) {
  97. require_once $this->extrafile;
  98. }
  99. setloginstatus($result['member'], $_GET['cookietime'] ? 2592000 : 0);
  100. checkfollowfeed();
  101. if($_G['group']['forcelogin']) {
  102. if($_G['group']['forcelogin'] == 1) {
  103. clearcookies();
  104. showmessage('location_login_force_qq');
  105. } elseif($_G['group']['forcelogin'] == 2 && $_GET['loginfield'] != 'email') {
  106. clearcookies();
  107. showmessage('location_login_force_mail');
  108. }
  109. }
  110. if($_G['member']['lastip'] && $_G['member']['lastvisit']) {
  111. dsetcookie('lip', $_G['member']['lastip'].','.$_G['member']['lastvisit']);
  112. }
  113. C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'port' => $_G['remoteport'], 'lastvisit' =>TIMESTAMP, 'lastactivity' => TIMESTAMP));
  114. $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
  115. $pwold = false;
  116. if($this->setting['strongpw'] && !$this->setting['pwdsafety']) {
  117. if(in_array(1, $this->setting['strongpw']) && !preg_match("/\d+/", $_GET['password'])) {
  118. $pwold = true;
  119. }
  120. if(in_array(2, $this->setting['strongpw']) && !preg_match("/[a-z]+/", $_GET['password'])) {
  121. $pwold = true;
  122. }
  123. if(in_array(3, $this->setting['strongpw']) && !preg_match("/[A-Z]+/", $_GET['password'])) {
  124. $pwold = true;
  125. }
  126. if(in_array(4, $this->setting['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['password'])) {
  127. $pwold = true;
  128. }
  129. }
  130. if($_G['member']['adminid'] != 1) {
  131. if($this->setting['accountguard']['loginoutofdate'] && $_G['member']['lastvisit'] && TIMESTAMP - $_G['member']['lastvisit'] > 90 * 86400) {
  132. C::t('common_member')->update($_G['uid'], array('freeze' => 2));
  133. C::t('common_member_validate')->insert(array(
  134. 'uid' => $_G['uid'],
  135. 'submitdate' => TIMESTAMP,
  136. 'moddate' => 0,
  137. 'admin' => '',
  138. 'submittimes' => 1,
  139. 'status' => 0,
  140. 'message' => '',
  141. 'remark' => '',
  142. ), false, true);
  143. manage_addnotify('verifyuser');
  144. showmessage('location_login_outofdate', 'home.php?mod=spacecp&ac=profile&op=password&resend=1', array('type' => 1), array('showdialog' => true, 'striptags' => false, 'locationtime' => true));
  145. }
  146. if($this->setting['accountguard']['loginpwcheck'] && $pwold) {
  147. $freeze = $pwold;
  148. if($this->setting['accountguard']['loginpwcheck'] == 2 && $freeze) {
  149. C::t('common_member')->update($_G['uid'], array('freeze' => 1));
  150. }
  151. }
  152. }
  153. $seccheckrule = & $_G['setting']['seccodedata']['rule']['login'];
  154. if($seccheckrule['allow'] == 2) {
  155. if($seccheckrule['nolocal']) {
  156. require_once libfile('function/misc');
  157. $lastipConvert = process_ipnotice(convertip($_G['member']['lastip']));
  158. $nowipConvert = process_ipnotice(convertip($_G['clientip']));
  159. if($lastipConvert != $nowipConvert && stripos($lastipConvert, $nowipConvert) == false && stripos($nowipConvert, $lastipConvert) == false) {
  160. $seccodecheck = true;
  161. }
  162. }
  163. if(!$seccodecheck && $seccheckrule['pwsimple'] && $pwold) {
  164. $seccodecheck = true;
  165. }
  166. if(!$seccodecheck && $seccheckrule['outofday'] && $_G['member']['lastvisit'] && TIMESTAMP - $_G['member']['lastvisit'] > $seccheckrule['outofday'] * 86400) {
  167. $seccodecheck = true;
  168. }
  169. if(!$seccodecheck && $_G['member_loginperm'] < 4) {
  170. $seccodecheck = true;
  171. }
  172. if(!$seccodecheck && $seccheckrule['numiptry']) {
  173. $seccodecheck = failedipcheck($seccheckrule['numiptry'], $seccheckrule['timeiptry']);
  174. }
  175. if($seccodecheck && !$secchecklogin2) {
  176. clearcookies();
  177. $auth = authcode($_GET['username']."\t".$_GET['password']."\t".($_GET['questionid'] ? 1 : 0)."\t1", 'ENCODE', $_G['config']['security']['authkey']);
  178. $location = 'member.php?mod=logging&action=login&auth='.rawurlencode($auth).'&referer='.rawurlencode(dreferer()).(!empty($_GET['cookietime']) ? '&cookietime=1' : '');
  179. if(defined('IN_MOBILE')) {
  180. showmessage('login_seccheck2', $location);
  181. } else {
  182. $js = '<script type="text/javascript">location.href=\''.$location.'\'</script>';
  183. showmessage('login_seccheck2', '', array('type' => 1), array('extrajs' => $js));
  184. }
  185. }
  186. }
  187. if($invite['id']) {
  188. $result = C::t('common_invite')->count_by_uid_fuid($invite['uid'], $uid);
  189. if(!$result) {
  190. C::t('common_invite')->update($invite['id'], array('fuid'=>$uid, 'fusername'=>$_G['username']));
  191. updatestat('invite');
  192. } else {
  193. $invite = array();
  194. }
  195. }
  196. if($invite['uid']) {
  197. require_once libfile('function/friend');
  198. friend_make($invite['uid'], $invite['username'], false);
  199. dsetcookie('invite_auth', '');
  200. if($invite['appid']) {
  201. updatestat('appinvite');
  202. }
  203. }
  204. $param = array(
  205. 'username' => $result['ucresult']['username'],
  206. 'usergroup' => $_G['group']['grouptitle'],
  207. 'uid' => $_G['member']['uid'],
  208. 'groupid' => $_G['groupid'],
  209. 'syn' => $ucsynlogin ? 1 : 0
  210. );
  211. $extra = array(
  212. 'showdialog' => true,
  213. 'locationtime' => true,
  214. 'extrajs' => $ucsynlogin
  215. );
  216. if(!$freeze || !$this->setting['accountguard']['loginpwcheck']) {
  217. $loginmessage = $_G['groupid'] == 8 ? 'login_succeed_inactive_member' : 'login_succeed';
  218. $location = $invite || $_G['groupid'] == 8 ? 'home.php?mod=space&do=home' : dreferer();
  219. } else {
  220. $loginmessage = 'login_succeed_password_change';
  221. $location = 'home.php?mod=spacecp&ac=profile&op=password';
  222. $_GET['lssubmit'] = 0;
  223. }
  224. if(empty($_GET['handlekey']) || !empty($_GET['lssubmit'])) {
  225. if(defined('IN_MOBILE')) {
  226. showmessage($loginmessage, $location, $param, array('location' => true));
  227. } else {
  228. if(!empty($_GET['lssubmit'])) {
  229. if(!$ucsynlogin) {
  230. $extra['location'] = true;
  231. }
  232. showmessage($loginmessage, $location, $param, $extra);
  233. } else {
  234. $href = str_replace("'", "\'", $location);
  235. showmessage('location_login_succeed', $location, array(),
  236. array(
  237. 'showid' => 'succeedmessage',
  238. 'extrajs' => '<script type="text/javascript">'.
  239. 'setTimeout("window.location.href =\''.$href.'\';", 3000);'.
  240. '$(\'succeedmessage_href\').href = \''.$href.'\';'.
  241. '$(\'main_message\').style.display = \'none\';'.
  242. '$(\'main_succeed\').style.display = \'\';'.
  243. '$(\'succeedlocation\').innerHTML = \''.lang('message', $loginmessage, $param).'\';</script>'.$ucsynlogin,
  244. 'striptags' => false,
  245. 'showdialog' => true
  246. )
  247. );
  248. }
  249. }
  250. } else {
  251. showmessage($loginmessage, $location, $param, $extra);
  252. }
  253. } else {
  254. $password = preg_replace("/^(.{".round(strlen($_GET['password']) / 4)."})(.+?)(.{".round(strlen($_GET['password']) / 6)."})$/s", "\\1***\\3", $_GET['password']);
  255. $errorlog = dhtmlspecialchars(
  256. TIMESTAMP."\t".
  257. ($result['ucresult']['username'] ? $result['ucresult']['username'] : $_GET['username'])."\t".
  258. $password."\t".
  259. "Ques #".intval($_GET['questionid'])."\t".
  260. $_G['clientip']);
  261. writelog('illegallog', $errorlog);
  262. loginfailed($_GET['username']);
  263. failedip();
  264. $fmsg = $result['ucresult']['uid'] == '-3' ? (empty($_GET['questionid']) || $answer == '' ? 'login_question_empty' : 'login_question_invalid') : 'login_invalid';
  265. if($_G['member_loginperm'] > 1) {
  266. showmessage($fmsg, '', array('loginperm' => $_G['member_loginperm'] - 1));
  267. } elseif($_G['member_loginperm'] == -1) {
  268. showmessage('login_password_invalid');
  269. } else {
  270. showmessage('login_strike');
  271. }
  272. }
  273. }
  274. }
  275. function on_logout() {
  276. global $_G;
  277. $ucsynlogout = $this->setting['allowsynlogin'] ? uc_user_synlogout() : '';
  278. if($_GET['formhash'] != $_G['formhash']) {
  279. showmessage('logout_succeed', dreferer(), array('formhash' => FORMHASH, 'ucsynlogout' => $ucsynlogout, 'referer' => rawurlencode(dreferer())));
  280. }
  281. clearcookies();
  282. $_G['groupid'] = $_G['member']['groupid'] = 7;
  283. $_G['uid'] = $_G['member']['uid'] = 0;
  284. $_G['username'] = $_G['member']['username'] = $_G['member']['password'] = '';
  285. $_G['setting']['styleid'] = $this->setting['styleid'];
  286. if(defined('IN_MOBILE')) {
  287. showmessage('location_logout_succeed_mobile', dreferer(), array('formhash' => FORMHASH, 'referer' => rawurlencode(dreferer())));
  288. } else {
  289. showmessage('logout_succeed', dreferer(), array('formhash' => FORMHASH, 'ucsynlogout' => $ucsynlogout, 'referer' => rawurlencode(dreferer())));
  290. }
  291. }
  292. }
  293. class register_ctl {
  294. var $showregisterform = 1;
  295. function register_ctl() {
  296. global $_G;
  297. if($_G['setting']['bbclosed']) {
  298. if(($_GET['action'] != 'activation' && !$_GET['activationauth']) || !$_G['setting']['closedallowactivation'] ) {
  299. showmessage('register_disable', NULL, array(), array('login' => 1));
  300. }
  301. }
  302. loadcache(array('modreasons', 'stamptypeid', 'fields_required', 'fields_optional', 'fields_register', 'ipctrl'));
  303. require_once libfile('function/misc');
  304. require_once libfile('function/profile');
  305. if(!function_exists('sendmail')) {
  306. include libfile('function/mail');
  307. }
  308. loaducenter();
  309. }
  310. function on_register() {
  311. global $_G;
  312. $_GET['username'] = trim($_GET[''.$this->setting['reginput']['username']]);
  313. $_GET['password'] = $_GET[''.$this->setting['reginput']['password']];
  314. $_GET['password2'] = $_GET[''.$this->setting['reginput']['password2']];
  315. $_GET['email'] = $_GET[''.$this->setting['reginput']['email']];
  316. if($_G['uid']) {
  317. $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
  318. $url_forward = dreferer();
  319. if(strpos($url_forward, $this->setting['regname']) !== false) {
  320. $url_forward = 'forum.php';
  321. }
  322. showmessage('login_succeed', $url_forward ? $url_forward : './', array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']), array('extrajs' => $ucsynlogin));
  323. } elseif(!$this->setting['regclosed'] && (!$this->setting['regstatus'] || !$this->setting['ucactivation'])) {
  324. if($_GET['action'] == 'activation' || $_GET['activationauth']) {
  325. if(!$this->setting['ucactivation'] && !$this->setting['closedallowactivation']) {
  326. showmessage('register_disable_activation');
  327. }
  328. } elseif(!$this->setting['regstatus']) {
  329. if($this->setting['regconnect']) {
  330. dheader('location:connect.php?mod=login&op=init&referer=forum.php&statfrom=login_simple');
  331. }
  332. showmessage(!$this->setting['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $this->setting['regclosemessage']));
  333. }
  334. }
  335. $bbrules = & $this->setting['bbrules'];
  336. $bbrulesforce = & $this->setting['bbrulesforce'];
  337. $bbrulestxt = & $this->setting['bbrulestxt'];
  338. $welcomemsg = & $this->setting['welcomemsg'];
  339. $welcomemsgtitle = & $this->setting['welcomemsgtitle'];
  340. $welcomemsgtxt = & $this->setting['welcomemsgtxt'];
  341. $regname = $this->setting['regname'];
  342. if($this->setting['regverify']) {
  343. if($this->setting['areaverifywhite']) {
  344. $location = $whitearea = '';
  345. $location = trim(convertip($_G['clientip'], "./"));
  346. if($location) {
  347. $whitearea = preg_quote(trim($this->setting['areaverifywhite']), '/');
  348. $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
  349. $whitearea = '.*'.$whitearea.'.*';
  350. $whitearea = '/^('.str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea).')$/i';
  351. if(@preg_match($whitearea, $location)) {
  352. $this->setting['regverify'] = 0;
  353. }
  354. }
  355. }
  356. if($_G['cache']['ipctrl']['ipverifywhite']) {
  357. foreach(explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) {
  358. if(preg_match("/^(".preg_quote(($ctrlip = trim($ctrlip)), '/').")/", $_G['clientip'])) {
  359. $this->setting['regverify'] = 0;
  360. break;
  361. }
  362. }
  363. }
  364. }
  365. $invitestatus = false;
  366. if($this->setting['regstatus'] == 2) {
  367. if($this->setting['inviteconfig']['inviteareawhite']) {
  368. $location = $whitearea = '';
  369. $location = trim(convertip($_G['clientip'], "./"));
  370. if($location) {
  371. $whitearea = preg_quote(trim($this->setting['inviteconfig']['inviteareawhite']), '/');
  372. $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
  373. $whitearea = '.*'.$whitearea.'.*';
  374. $whitearea = '/^('.str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea).')$/i';
  375. if(@preg_match($whitearea, $location)) {
  376. $invitestatus = true;
  377. }
  378. }
  379. }
  380. if($this->setting['inviteconfig']['inviteipwhite']) {
  381. foreach(explode("\n", $this->setting['inviteconfig']['inviteipwhite']) as $ctrlip) {
  382. if(preg_match("/^(".preg_quote(($ctrlip = trim($ctrlip)), '/').")/", $_G['clientip'])) {
  383. $invitestatus = true;
  384. break;
  385. }
  386. }
  387. }
  388. }
  389. $groupinfo = array();
  390. if($this->setting['regverify']) {
  391. $groupinfo['groupid'] = 8;
  392. } else {
  393. $groupinfo['groupid'] = $this->setting['newusergroupid'];
  394. }
  395. list($seccodecheck, $secqaacheck) = seccheck('register');
  396. $fromuid = !empty($_G['cookie']['promotion']) && $this->setting['creditspolicy']['promotion_register'] ? intval($_G['cookie']['promotion']) : 0;
  397. $username = isset($_GET['username']) ? $_GET['username'] : '';
  398. $bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : '';
  399. $auth = $_GET['auth'];
  400. if(!$invitestatus) {
  401. $invite = getinvite();
  402. }
  403. $sendurl = $this->setting['sendregisterurl'] ? true : false;
  404. if($sendurl) {
  405. if(!empty($_GET['hash'])) {
  406. $_GET['hash'] = preg_replace("/[^\[A-Za-z0-9_\]%\s+-\/=]/", '', $_GET['hash']);
  407. $hash = explode("\t", authcode($_GET['hash'], 'DECODE', $_G['config']['security']['authkey']));
  408. if(is_array($hash) && isemail($hash[0]) && TIMESTAMP - $hash[1] < 259200) {
  409. $sendurl = false;
  410. }
  411. }
  412. }
  413. if(!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) {
  414. if($_GET['action'] == 'activation') {
  415. $auth = explode("\t", authcode($auth, 'DECODE'));
  416. if(FORMHASH != $auth[1]) {
  417. showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
  418. }
  419. $username = $auth[0];
  420. $activationauth = authcode("$auth[0]\t".FORMHASH, 'ENCODE');
  421. $sendurl = false;
  422. }
  423. if(!$sendurl) {
  424. if($fromuid) {
  425. $member = getuserbyuid($fromuid);
  426. if(!empty($member)) {
  427. $fromuser = dhtmlspecialchars($member['username']);
  428. } else {
  429. dsetcookie('promotion');
  430. }
  431. }
  432. if($_GET['action'] == 'activation') {
  433. $auth = dhtmlspecialchars($auth);
  434. }
  435. if($seccodecheck) {
  436. $seccode = random(6, 1);
  437. }
  438. $username = dhtmlspecialchars($username);
  439. $htmls = $settings = array();
  440. foreach($_G['cache']['fields_register'] as $field) {
  441. $fieldid = $field['fieldid'];
  442. $html = profile_setting($fieldid, array(), false, false, true);
  443. if($html) {
  444. $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
  445. $htmls[$fieldid] = $html;
  446. }
  447. }
  448. $navtitle = $this->setting['reglinkname'];
  449. if($this->extrafile && file_exists($this->extrafile)) {
  450. require_once $this->extrafile;
  451. }
  452. }
  453. $bbrulestxt = nl2br("\n$bbrulestxt\n\n");
  454. $dreferer = dreferer();
  455. include template($this->template);
  456. } else {
  457. $activationauth = array();
  458. if(isset($_GET['activationauth']) && $_GET['activationauth']) {
  459. $activationauth = explode("\t", authcode($_GET['activationauth'], 'DECODE'));
  460. if($activationauth[1] != FORMHASH) {
  461. showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
  462. }
  463. $sendurl = false;
  464. }
  465. if(!$activationauth && $sendurl) {
  466. checkemail($_GET['email']);
  467. }
  468. if($sendurl) {
  469. $hashstr = urlencode(authcode("$_GET[email]\t$_G[timestamp]", 'ENCODE', $_G['config']['security']['authkey']));
  470. $registerurl = "{$_G[siteurl]}member.php?mod=".$this->setting['regname']."&amp;hash={$hashstr}&amp;email={$_GET[email]}";
  471. $email_register_message = lang('email', 'email_register_message', array(
  472. 'bbname' => $this->setting['bbname'],
  473. 'siteurl' => $_G['siteurl'],
  474. 'url' => $registerurl
  475. ));
  476. if(!sendmail("$_GET[email] <$_GET[email]>", lang('email', 'email_register_subject'), $email_register_message)) {
  477. runlog('sendmail', "$_GET[email] sendmail failed.");
  478. }
  479. showmessage('register_email_send_succeed', dreferer(), array('bbname' => $this->setting['bbname']), array('showdialog' => false, 'msgtype' => 3, 'closetime' => 10));
  480. }
  481. $emailstatus = 0;
  482. if($this->setting['sendregisterurl'] && !$sendurl) {
  483. $_GET['email'] = strtolower($hash[0]);
  484. $this->setting['regverify'] = $this->setting['regverify'] == 1 ? 0 : $this->setting['regverify'];
  485. if(!$this->setting['regverify']) {
  486. $groupinfo['groupid'] = $this->setting['newusergroupid'];
  487. }
  488. $emailstatus = 1;
  489. }
  490. if($this->setting['regstatus'] == 2 && empty($invite) && !$invitestatus) {
  491. showmessage('not_open_registration_invite');
  492. }
  493. if($bbrules && $bbrulehash != $_POST['agreebbrule']) {
  494. showmessage('register_rules_agree');
  495. }
  496. $activation = array();
  497. if(isset($_GET['activationauth']) && $activationauth && is_array($activationauth)) {
  498. if($activationauth[1] == FORMHASH && !($activation = uc_get_user($activationauth[0]))) {
  499. showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
  500. }
  501. }
  502. if(!$activation) {
  503. $usernamelen = dstrlen($username);
  504. if($usernamelen < 3) {
  505. showmessage('profile_username_tooshort');
  506. } elseif($usernamelen > 15) {
  507. showmessage('profile_username_toolong');
  508. }
  509. if(uc_get_user(addslashes($username)) && !C::t('common_member')->fetch_uid_by_username($username) && !C::t('common_member_archive')->fetch_uid_by_username($username)) {
  510. if($_G['inajax']) {
  511. showmessage('profile_username_duplicate');
  512. } else {
  513. showmessage('register_activation_message', 'member.php?mod=logging&action=login', array('username' => $username));
  514. }
  515. }
  516. if($this->setting['pwlength']) {
  517. if(strlen($_GET['password']) < $this->setting['pwlength']) {
  518. showmessage('profile_password_tooshort', '', array('pwlength' => $this->setting['pwlength']));
  519. }
  520. }
  521. if($this->setting['strongpw']) {
  522. $strongpw_str = array();
  523. if(in_array(1, $this->setting['strongpw']) && !preg_match("/\d+/", $_GET['password'])) {
  524. $strongpw_str[] = lang('member/template', 'strongpw_1');
  525. }
  526. if(in_array(2, $this->setting['strongpw']) && !preg_match("/[a-z]+/", $_GET['password'])) {
  527. $strongpw_str[] = lang('member/template', 'strongpw_2');
  528. }
  529. if(in_array(3, $this->setting['strongpw']) && !preg_match("/[A-Z]+/", $_GET['password'])) {
  530. $strongpw_str[] = lang('member/template', 'strongpw_3');
  531. }
  532. if(in_array(4, $this->setting['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['password'])) {
  533. $strongpw_str[] = lang('member/template', 'strongpw_4');
  534. }
  535. if($strongpw_str) {
  536. showmessage(lang('member/template', 'password_weak').implode(',', $strongpw_str));
  537. }
  538. }
  539. $email = strtolower(trim($_GET['email']));
  540. if(empty($this->setting['ignorepassword'])) {
  541. if($_GET['password'] !== $_GET['password2']) {
  542. showmessage('profile_passwd_notmatch');
  543. }
  544. if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {
  545. showmessage('profile_passwd_illegal');
  546. }
  547. $password = $_GET['password'];
  548. } else {
  549. $password = md5(random(10));
  550. }
  551. }
  552. $censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($this->setting['censoruser'] = trim($this->setting['censoruser'])), '/')).')$/i';
  553. if($this->setting['censoruser'] && @preg_match($censorexp, $username)) {
  554. showmessage('profile_username_protect');
  555. }
  556. if($this->setting['regverify'] == 2 && !trim($_GET['regmessage'])) {
  557. showmessage('profile_required_info_invalid');
  558. }
  559. if($_G['cache']['ipctrl']['ipregctrl']) {
  560. foreach(explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) {
  561. if(preg_match("/^(".preg_quote(($ctrlip = trim($ctrlip)), '/').")/", $_G['clientip'])) {
  562. $ctrlip = $ctrlip.'%';
  563. $this->setting['regctrl'] = $this->setting['ipregctrltime'];
  564. break;
  565. } else {
  566. $ctrlip = $_G['clientip'];
  567. }
  568. }
  569. } else {
  570. $ctrlip = $_G['clientip'];
  571. }
  572. if($this->setting['regctrl']) {
  573. if(C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp']-$this->setting['regctrl']*3600)) {
  574. showmessage('register_ctrl', NULL, array('regctrl' => $this->setting['regctrl']));
  575. }
  576. }
  577. $setregip = null;
  578. if($this->setting['regfloodctrl']) {
  579. $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp']-86400);
  580. if($regip) {
  581. if($regip['count'] >= $this->setting['regfloodctrl']) {
  582. showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $this->setting['regfloodctrl']));
  583. } else {
  584. $setregip = 1;
  585. }
  586. } else {
  587. $setregip = 2;
  588. }
  589. }
  590. $profile = $verifyarr = array();
  591. foreach($_G['cache']['fields_register'] as $field) {
  592. if(defined('IN_MOBILE')) {
  593. break;
  594. }
  595. $field_key = $field['fieldid'];
  596. $field_val = $_GET[''.$field_key];
  597. if($field['formtype'] == 'file' && !empty($_FILES[$field_key]) && $_FILES[$field_key]['error'] == 0) {
  598. $field_val = true;
  599. }
  600. if(!profile_check($field_key, $field_val)) {
  601. $showid = !in_array($field['fieldid'], array('birthyear', 'birthmonth')) ? $field['fieldid'] : 'birthday';
  602. showmessage($field['title'].lang('message', 'profile_illegal'), '', array(), array(
  603. 'showid' => 'chk_'.$showid,
  604. 'extrajs' => $field['title'].lang('message', 'profile_illegal').($field['formtype'] == 'text' ? '<script type="text/javascript">'.
  605. '$(\'registerform\').'.$field['fieldid'].'.className = \'px er\';'.
  606. '$(\'registerform\').'.$field['fieldid'].'.onblur = function () { if(this.value != \'\') {this.className = \'px\';$(\'chk_'.$showid.'\').innerHTML = \'\';}}'.
  607. '</script>' : '')
  608. ));
  609. }
  610. if($field['needverify']) {
  611. $verifyarr[$field_key] = $field_val;
  612. } else {
  613. $profile[$field_key] = $field_val;
  614. }
  615. }
  616. if(!$activation) {
  617. $uid = uc_user_register(addslashes($username), $password, $email, $questionid, $answer, $_G['clientip']);
  618. if($uid <= 0) {
  619. if($uid == -1) {
  620. showmessage('profile_username_illegal');
  621. } elseif($uid == -2) {
  622. showmessage('profile_username_protect');
  623. } elseif($uid == -3) {
  624. showmessage('profile_username_duplicate');
  625. } elseif($uid == -4) {
  626. showmessage('profile_email_illegal');
  627. } elseif($uid == -5) {
  628. showmessage('profile_email_domain_illegal');
  629. } elseif($uid == -6) {
  630. showmessage('profile_email_duplicate');
  631. } else {
  632. showmessage('undefined_action');
  633. }
  634. }
  635. } else {
  636. list($uid, $username, $email) = $activation;
  637. }
  638. $_G['username'] = $username;
  639. if(getuserbyuid($uid, 1)) {
  640. if(!$activation) {
  641. uc_user_delete($uid);
  642. }
  643. showmessage('profile_uid_duplicate', '', array('uid' => $uid));
  644. }
  645. $password = md5(random(10));
  646. $secques = $questionid > 0 ? random(8) : '';
  647. if(isset($_POST['birthmonth']) && isset($_POST['birthday'])) {
  648. $profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
  649. }
  650. if(isset($_POST['birthyear'])) {
  651. $profile['zodiac'] = get_zodiac($_POST['birthyear']);
  652. }
  653. if($_FILES) {
  654. $upload = new discuz_upload();
  655. foreach($_FILES as $key => $file) {
  656. $field_key = 'field_'.$key;
  657. if(!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') {
  658. $upload->init($file, 'profile');
  659. $attach = $upload->attach;
  660. if(!$upload->error()) {
  661. $upload->save();
  662. if(!$upload->get_image_info($attach['target'])) {
  663. @unlink($attach['target']);
  664. continue;
  665. }
  666. $attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
  667. if($_G['cache']['fields_register'][$field_key]['needverify']) {
  668. $verifyarr[$key] = $attach['attachment'];
  669. } else {
  670. $profile[$key] = $attach['attachment'];
  671. }
  672. }
  673. }
  674. }
  675. }
  676. if($setregip !== null) {
  677. if($setregip == 1) {
  678. C::t('common_regip')->update_count_by_ip($_G['clientip']);
  679. } else {
  680. C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp']));
  681. }
  682. }
  683. if($invite && $this->setting['inviteconfig']['invitegroupid']) {
  684. $groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid'];
  685. }
  686. $init_arr = array('credits' => explode(',', $this->setting['initcredits']), 'profile'=>$profile, 'emailstatus' => $emailstatus);
  687. C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
  688. if($emailstatus) {
  689. updatecreditbyaction('realemail', $uid);
  690. }
  691. if($verifyarr) {
  692. $setverify = array(
  693. 'uid' => $uid,
  694. 'username' => $username,
  695. 'verifytype' => '0',
  696. 'field' => serialize($verifyarr),
  697. 'dateline' => TIMESTAMP,
  698. );
  699. C::t('common_member_verify_info')->insert($setverify);
  700. C::t('common_member_verify')->insert(array('uid' => $uid));
  701. }
  702. require_once libfile('cache/userstats', 'function');
  703. build_cache_userstats();
  704. if($this->extrafile && file_exists($this->extrafile)) {
  705. require_once $this->extrafile;
  706. }
  707. if($this->setting['regctrl'] || $this->setting['regfloodctrl']) {
  708. C::t('common_regip')->delete_by_dateline($_G['timestamp']-($this->setting['regctrl'] > 72 ? $this->setting['regctrl'] : 72)*3600);
  709. if($this->setting['regctrl']) {
  710. C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
  711. }
  712. }
  713. $regmessage = dhtmlspecialchars($_GET['regmessage']);
  714. if($this->setting['regverify'] == 2) {
  715. C::t('common_member_validate')->insert(array(
  716. 'uid' => $uid,
  717. 'submitdate' => $_G['timestamp'],
  718. 'moddate' => 0,
  719. 'admin' => '',
  720. 'submittimes' => 1,
  721. 'status' => 0,
  722. 'message' => $regmessage,
  723. 'remark' => '',
  724. ), false, true);
  725. manage_addnotify('verifyuser');
  726. }
  727. setloginstatus(array(
  728. 'uid' => $uid,
  729. 'username' => $_G['username'],
  730. 'password' => $password,
  731. 'groupid' => $groupinfo['groupid'],
  732. ), 0);
  733. include_once libfile('function/stat');
  734. updatestat('register');
  735. if($invite['id']) {
  736. $result = C::t('common_invite')->count_by_uid_fuid($invite['uid'], $uid);
  737. if(!$result) {
  738. C::t('common_invite')->update($invite['id'], array('fuid'=>$uid, 'fusername'=>$_G['username'], 'regdateline' => $_G['timestamp'], 'status' => 2));
  739. updatestat('invite');
  740. } else {
  741. $invite = array();
  742. }
  743. }
  744. if($invite['uid']) {
  745. if($this->setting['inviteconfig']['inviteaddcredit']) {
  746. updatemembercount($uid, array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['inviteaddcredit']));
  747. }
  748. if($this->setting['inviteconfig']['invitedaddcredit']) {
  749. updatemembercount($invite['uid'], array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['invitedaddcredit']));
  750. }
  751. require_once libfile('function/friend');
  752. friend_make($invite['uid'], $invite['username'], false);
  753. notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid='.$invite['uid'].'" target="_blank">'.$invite['username'].'</a>'), 1);
  754. space_merge($invite, 'field_home');
  755. if(!empty($invite['privacy']['feed']['invite'])) {
  756. require_once libfile('function/feed');
  757. $tite_data = array('username' => '<a href="home.php?mod=space&uid='.$_G['uid'].'">'.$_G['username'].'</a>');
  758. feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']);
  759. }
  760. if($invite['appid']) {
  761. updatestat('appinvite');
  762. }
  763. }
  764. if($welcomemsg && !empty($welcomemsgtxt)) {
  765. $welcomemsgtitle = replacesitevar($welcomemsgtitle);
  766. $welcomemsgtxt = replacesitevar($welcomemsgtxt);
  767. if($welcomemsg == 1) {
  768. $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
  769. notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1);
  770. } elseif($welcomemsg == 2) {
  771. sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
  772. } elseif($welcomemsg == 3) {
  773. sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
  774. $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
  775. notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1);
  776. }
  777. }
  778. if($fromuid) {
  779. updatecreditbyaction('promotion_register', $fromuid);
  780. dsetcookie('promotion', '');
  781. }
  782. dsetcookie('loginuser', '');
  783. dsetcookie('activationauth', '');
  784. dsetcookie('invite_auth', '');
  785. $url_forward = dreferer();
  786. $refreshtime = 3000;
  787. switch($this->setting['regverify']) {
  788. case 1:
  789. $idstring = random(6);
  790. $authstr = $this->setting['regverify'] == 1 ? "$_G[timestamp]\t2\t$idstring" : '';
  791. C::t('common_member_field_forum')->update($_G['uid'], array('authstr' => $authstr));
  792. $verifyurl = "{$_G[siteurl]}member.php?mod=activate&amp;uid={$_G[uid]}&amp;id=$idstring";
  793. $email_verify_message = lang('email', 'email_verify_message', array(
  794. 'username' => $_G['member']['username'],
  795. 'bbname' => $this->setting['bbname'],
  796. 'siteurl' => $_G['siteurl'],
  797. 'url' => $verifyurl
  798. ));
  799. if(!sendmail("$username <$email>", lang('email', 'email_verify_subject'), $email_verify_message)) {
  800. runlog('sendmail', "$email sendmail failed.");
  801. }
  802. $message = 'register_email_verify';
  803. $locationmessage = 'register_email_verify_location';
  804. $refreshtime = 10000;
  805. break;
  806. case 2:
  807. $message = 'register_manual_verify';
  808. $locationmessage = 'register_manual_verify_location';
  809. break;
  810. default:
  811. $message = 'register_succeed';
  812. $locationmessage = 'register_succeed_location';
  813. break;
  814. }
  815. $param = array('bbname' => $this->setting['bbname'], 'username' => $_G['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']);
  816. if(strpos($url_forward, $this->setting['regname']) !== false || strpos($url_forward, 'buyinvitecode') !== false) {
  817. $url_forward = 'forum.php';
  818. }
  819. $href = str_replace("'", "\'", $url_forward);
  820. $extra = array(
  821. 'showid' => 'succeedmessage',
  822. 'extrajs' => '<script type="text/javascript">'.
  823. 'setTimeout("window.location.href =\''.$href.'\';", '.$refreshtime.');'.
  824. '$(\'succeedmessage_href\').href = \''.$href.'\';'.
  825. '$(\'main_message\').style.display = \'none\';'.
  826. '$(\'main_succeed\').style.display = \'\';'.
  827. '$(\'succeedlocation\').innerHTML = \''.lang('message', $locationmessage).'\';'.
  828. '</script>',
  829. 'striptags' => false,
  830. );
  831. showmessage($message, $url_forward, $param, $extra);
  832. }
  833. }
  834. }
  835. class crime_action_ctl {
  836. static $actions = array('all', 'crime_delpost', 'crime_warnpost', 'crime_banpost', 'crime_banspeak', 'crime_banvisit', 'crime_banstatus', 'crime_avatar', 'crime_sightml', 'crime_customstatus');
  837. function crime_action_ctl() {}
  838. function &instance() {
  839. static $object;
  840. if(empty($object)) {
  841. $object = new crime_action_ctl();
  842. }
  843. return $object;
  844. }
  845. function recordaction($uid, $action, $reason) {
  846. global $_G;
  847. $uid = intval($uid);
  848. $key = array_search($action, self::$actions);
  849. if($key === FALSE) {
  850. return false;
  851. }
  852. $insert = array(
  853. 'uid' => $uid,
  854. 'operatorid' => $_G['uid'],
  855. 'operator' => $_G['username'],
  856. 'action' => $key,
  857. 'reason' => $reason,
  858. 'dateline' => $_G['timestamp']
  859. );
  860. C::t('common_member_crime')->insert($insert);
  861. return true;
  862. }
  863. function getactionlist($uid) {
  864. $uid = intval($uid);
  865. $clist = array();
  866. foreach(C::t('common_member_crime')->fetch_all_by_uid($uid) as $c) {
  867. $c['action'] = self::$actions[$c['action']];
  868. $clist[] = $c;
  869. }
  870. return $clist;
  871. }
  872. function getcount($uid, $action) {
  873. $uid = intval($uid);
  874. $key = array_search($action, self::$actions);
  875. if($key === FALSE) {
  876. return 0;
  877. }
  878. return C::t('common_member_crime')->count_by_uid_action($uid, $key);
  879. }
  880. function search($action, $username, $operator, $startime, $endtime, $reason, $start, $limit) {
  881. $action = intval($action);
  882. $operator = daddslashes(trim($operator));
  883. $starttime = $starttime ? strtotime($starttime) : 0;
  884. $endtime = $endtime ? (strtotime($endtime) + 3600 * 24) : 0;
  885. $reason = daddslashes(trim($reason));
  886. $start = intval($start);
  887. $limit = intval($limit);
  888. if(!empty($username)) {
  889. $uid = C::t('common_member')->fetch_uid_by_username($username);
  890. $wheresql[] = "uid='$uid'";
  891. }
  892. if($action) {
  893. $wheresql[] = "action='$action'";
  894. }
  895. if($operator) {
  896. $wheresql[] = "operator='$operator'";
  897. }
  898. if($starttime) {
  899. $wheresql[] = "dateline>='$starttime'";
  900. }
  901. if($endtime) {
  902. $wheresql[] = "dateline<='$endtime'";
  903. }
  904. if($reason) {
  905. $wheresql[] = "reason LIKE '%$reason%'";
  906. }
  907. if($wheresql) {
  908. $wheresql = 'WHERE '.implode(' AND ', $wheresql);
  909. } else {
  910. $wheresql = '';
  911. }
  912. $clist = array();
  913. $count = C::t('common_member_crime')->count_by_where($wheresql);
  914. if($count) {
  915. $uids = array();
  916. foreach(C::t('common_member_crime')->fetch_all_by_where($wheresql, $start, $limit) as $crime) {
  917. $crime['action'] = self::$actions[$crime['action']];
  918. $clist[] = $crime;
  919. $uids[$crime['uid']] = $crime['uid'];
  920. }
  921. $members = C::t('common_member')->fetch_all($uids, false, 0);
  922. foreach($clist as $key => $crime) {
  923. $crime['username'] = $members[$crime['uid']]['username'];
  924. $clist[$key] = $crime;
  925. }
  926. }
  927. return array($count, $clist);
  928. }
  929. }
  930. ?>