private function onRegister() { $form = $this->getForm(); $errorsA = $errorsB = ''; if (false !== ($errorsA = $form->validate($this->module)) || false !== ($errorsB = $this->onRegisterB())) { return $errorsA . $errorsB . $this->templateForm(); } $username = Common::getPost('username'); $password = Common::getPost('password'); $email = Common::getPost('email'); $birthdate = sprintf('%04d%02d%02d', Common::getPost('birthdatey'), Common::getPost('birthdatem'), Common::getPost('birthdated')); $default_country = $this->module->cfgDetectCountry() ? GWF_IP2Country::detectCountryID() : 0; $countryid = $form->getVar('countryid', $default_country); require_once GWF_CORE_PATH . 'module/Register/GWF_UserActivation.php'; $token = GWF_UserActivation::generateToken(); $ua = new GWF_UserActivation(array('username' => $username, 'email' => $email, 'token' => $token, 'birthdate' => $birthdate, 'countryid' => $countryid, 'password' => GWF_Password::hashPasswordS($password), 'timestamp' => time(), 'ip' => GWF_IP6::getIP(GWF_IP_EXACT))); if (false === $ua->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateForm(); } if ($this->module->wantEmailActivation()) { return $this->sendEmail($username, $email, $token, $password); } else { GWF_Website::redirect(GWF_WEB_ROOT . 'quick_activate/' . $token); } return $this->module->message('msg_registered'); }
private function getHighlightCountry() { if (false === ($user = GWF_Session::getUser()) || '0' === ($cid = $user->getVar('user_countryid'))) { return GWF_IP2Country::detectCountryID(); } else { return $cid; } }
public static function getCountryIDbyIP() { return GWF_IP2Country::detectCountryID(); }