/** * @brief register 用户注册 * * @return void */ public function register() { if (OptionLibrary::get('register') == 'close') { $r = array('success' => FALSE, 'message' => _t('Register closed.')); Response::ajaxReturn($r); return; } $u = array(); $u['username'] = Request::P('username', 'string'); $u['email'] = Request::P('email', 'string'); if ($u['username'] == NULL || $u['email'] == NULL) { $r = array('success' => FALSE, 'message' => _t('Username or Email missed.')); Response::ajaxReturn($r); return; } $u['password'] = LogX::randomString(8); $u['website'] = ''; $u['group'] = 1; $user = new UserLibrary(); if ($uid = $user->addUser($u)) { $r = array('success' => TRUE, 'message' => sprintf(_t('Register successed, you password is <b>%s</b>.'), $u['password'])); } else { $r = array('success' => FALSE, 'message' => _t('Username or Email existed.')); } Response::ajaxReturn($r); }