/** * @brief ajax call for signup. returns status code * @details * for use with ajax call or standalone data call only * @requestParam string userloginext01 //CE-413 signup spam attack - changing username field to userloginext01 * @requestParam string email * @requestParam string userloginext02 //CE-413 signup spam attack - changing password field to userloginext02 * @requestParam string birthmonth * @requestParam string birthday * @requestParam string birthyear * @requestParam string captcha * @responseParam string result [ok/error] * @responseParam string msg - result message * @responseParam string errParam - error param */ public function signup() { // Init session if necessary if (session_id() == '') { wfSetupSession(); } if ($this->wg->request->getVal('type', '') == '') { $this->wg->request->setVal('type', 'signup'); } $signupForm = new UserLoginForm($this->wg->request); $signupForm->load(); if (!$signupForm->EmptySpamFields()) { $this->result = 'error'; return; } $byemail = $this->wg->request->getBool('byemail', false); if ($byemail) { $ret = $signupForm->addNewAccountMailPassword(); } else { $ret = $signupForm->addNewAccount(); } // pass and ID of created account for FBConnect feature if ($ret instanceof User) { $this->userId = $ret->getId(); $this->userPage = $ret->getUserPage()->getFullUrl(); } // At this point, when the account creation fails for any reason, // we must have $signupForm->msgType set to 'error' and $signupForm->msg // containing a relevant message. As for $ret, we expect an instance of // User on success; false otherwise. $this->result = $signupForm->msgType == 'error' ? $signupForm->msgType : 'ok'; $this->msg = $signupForm->msg; $this->errParam = $signupForm->errParam; }