本文整理汇总了PHP中Model_Users::isExistEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::isExistEmail方法的具体用法?PHP Model_Users::isExistEmail怎么用?PHP Model_Users::isExistEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Users
的用法示例。
在下文中一共展示了Model_Users::isExistEmail方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_emailAction
public function check_emailAction()
{
$request = $this->getRequest();
$username = trim($request->getPost('raw'));
if (strlen($username) < 5) {
// $this->view->error = $this->translate('Please use at least 5 characters');
} else {
$validate = new Helper_Validate();
$validate->_set_rules($username, $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
if ($validate->_valid_form()) {
if (Model_Users::isExistEmail($username)) {
$validate->_set_form_errors($this->translate('This email is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$this->view->success = $this->translate('Available');
} else {
$this->view->error = $validate->_get_error_messages();
}
}
echo $this->renderScript('json');
}
示例2: registerAction
public function registerAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')));
}
$shared_content = null;
if (!Helper_Config::get('enable_free_registration')) {
$invateObject = new Model_Users_Invate();
$shared_content = $invateObject->isInvated($request->getParam('key'), $request->getParam('user_id'));
if (!$shared_content) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
}
}
$this->view->error = false;
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
$validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
if ($validate->_valid_form()) {
if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
$validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistEmail($request->getPost('email'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$result = new Model_Users_Create(array('username' => $request->getPost('username'), 'firstname' => $request->getPost('firstname'), 'lastname' => $request->getPost('lastname'), 'email' => $request->getPost('email'), 'password' => $request->getPost('password')));
if ($result->user_id) {
$user_data = new Model_Users_User($result->user_id);
if ($user_data) {
if ($shared_content) {
$follow = new Model_Users_Follow($result->user_id, $shared_content['user_id']);
if (!$follow->is_follow) {
$follow->followUser();
}
$follow = new Model_Users_Follow($shared_content['user_id'], $result->user_id);
if (!$follow->is_follow) {
$follow->followUser();
}
}
JO_Session::set(array('user' => $user_data->toArray()));
$this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
} else {
$this->view->error = $this->translate('There was a problem with the record. Please try again!');
}
} else {
$this->view->error = $this->translate('There was a problem with the record. Please try again!');
}
} else {
$this->view->error = $validate->_get_error_messages();
}
}
$this->view->baseUrl = $request->getBaseUrl();
if ($request->issetPost('email')) {
$this->view->email = $request->getPost('email');
} else {
if (isset($shared_content['email'])) {
$this->view->email = $shared_content['email'];
} else {
$this->view->email = '';
}
}
if ($request->issetPost('firstname')) {
$this->view->firstname = $request->getPost('firstname');
} else {
$this->view->firstname = '';
}
if ($request->issetPost('lastname')) {
$this->view->lastname = $request->getPost('lastname');
} else {
$this->view->lastname = '';
}
if ($request->issetPost('username')) {
$this->view->username = $request->getPost('username');
} else {
$this->view->username = '';
}
$this->view->password = $request->getPost('password');
$this->view->password2 = $request->getPost('password2');
//extensions
$this->view->user_login_buttons = array();
$user_login_buttons = Model_Extensions::getByMethod('user_register');
foreach ($user_login_buttons as $id => $login) {
$this->view->user_login_buttons[] = array('html' => $this->view->callChildren('modules_' . $login . '_registerbutton', WM_Router::create($request->getBaseUrl() . '?controller=modules_' . $login . '_register')), 'view' => $this->view->callChildrenView('modules_' . $login . '_registerbutton', WM_Router::create($request->getBaseUrl() . '?controller=modules_' . $login . '_register')), 'key' => $login);
}
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例3: createAction
public function createAction()
{
if (!WM_Users::allow('create', $this->getRequest()->getController())) {
$this->forward('error', 'noPermission');
}
$this->setViewChange('form');
$request = $this->getRequest();
if ($request->isPost()) {
if (trim($request->getPost('password')) and !Model_Users::isExistEmail($request->getPost('email')) and !Model_Users::isExistUsername($request->getPost('username'))) {
Model_Users::createUser($request->getParams());
$this->session->set('successfu_edite', true);
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/');
}
}
$this->view->new = true;
$this->getForm();
}
示例4: registrationAction
public function registrationAction()
{
$request = $this->getRequest();
if (JO_Session::get('user_id')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'));
}
$this->view->usersCount = Model_Users::countUsers();
$this->view->itemsCount = Model_Items::countItems();
$this->getLayout()->meta_title = $this->translate('Registration');
$this->getLayout()->meta_description = $this->translate('Registration');
$captcha = new Model_Recaptcha();
$captcha->publicKey = JO_Registry::get('recaptcha_public_key');
$captcha->privateKey = JO_Registry::get('recaptcha_private_key');
if (JO_Session::issetKey('data')) {
if (JO_Session::issetKey('msg_error')) {
$this->view->msg_error = JO_Session::get('msg_error');
JO_Session::clear('msg_error');
} elseif (JO_Session::issetKey('error')) {
$this->view->error = JO_Session::get('error');
JO_Session::clear('error');
}
$this->view->user = JO_Session::get('data');
JO_Session::clear('data');
}
if (JO_Session::issetKey('fb_data')) {
$this->view->user = JO_Session::get('fb_data');
JO_Session::clear('fb_data');
}
if ($request->isPost()) {
$captcha->checkCaptcha();
$error = array();
$this->view->firstname = trim($request->getPost('firstname'));
$this->view->lastname = trim($request->getPost('lastname'));
$this->view->email = trim($request->getPost('email'));
$this->view->email_confirm = trim($request->getPost('email_confirm'));
$this->view->username = trim($request->getPost('username'));
$this->view->password = trim($this->getRequest()->getPost('password'));
$this->view->password_confirm = trim($request->getPost('password_confirm'));
if (empty($this->view->firstname)) {
$error['efirstname'] = $this->translate('You must type your first name');
}
if (empty($this->view->lastname)) {
$error['elastname'] = $this->translate('You must type your last name');
}
if (empty($this->view->email)) {
$error['eemail'] = $this->translate('You must type your email');
} elseif (!Model_Users::ValidMail($this->view->email)) {
$error['eemail'] = $this->translate('You must type valid email');
} elseif (Model_Users::isExistEmail($this->view->email)) {
$error['eemail'] = $this->translate('The email you have entered is already in our database');
}
if (empty($this->view->email_confirm)) {
$error['eemail_confirm'] = $this->translate('You must retype your email');
} elseif ($this->view->email_confirm != $this->view->email) {
$error['eemail_confirm'] = $this->translate('The email adresses you have entered, does not match');
}
$methodNames = array();
if (version_compare(PHP_VERSION, '5.2.6') === -1) {
$class = new ReflectionObject($this);
$classMethods = $class->getMethods();
foreach ($classMethods as $method) {
$methodNames[] = $method->getName();
}
} else {
$methodNames = get_class_methods($this);
}
$temp_methodNames = array();
foreach ($methodNames as $methodName) {
if (preg_match('/^([\\w]{1,})Action$/i', $methodName, $match)) {
$temp_methodNames[] = $match[1];
}
}
$temp_methodNames = array_change_key_case($temp_methodNames, CASE_LOWER);
if (empty($this->view->username)) {
$error['eusername'] = $this->translate('You must type your username');
} elseif (!preg_match('/^[a-zA-Z0-9_]+$/i', $this->view->username)) {
$error['eusername'] = $this->translate('The username you have entered is not valid');
} elseif (Model_Users::isExistUsername($this->view->username)) {
$error['eusername'] = $this->translate('There is already registration with that username');
} elseif (in_array(strtolower($this->view->username), $temp_methodNames)) {
$error['eusername'] = $this->translate('This username can not be registered');
}
if (empty($this->view->password)) {
$error['epassword'] = $this->translate('You must type your password');
}
if (empty($this->view->password_confirm)) {
$error['epassword_confirm'] = $this->translate('You must retype your password');
} elseif ($this->view->password_confirm != $this->view->password) {
$error['epassword_confirm'] = $this->translate('The passwords you have entered does not match');
}
if ($captcha->getError()) {
$error['ecaptcha'] = $this->translate('You must fill correct captcha');
}
if (!$request->getPost('terms')) {
$error['eterms'] = $this->translate('You must agree with the terms');
}
if (!count($error)) {
$activationKey = md5(rand(0, 10000) . date('HisdmY') . rand(0, 10000));
if (!is_null(JO_Cookie::get('referral'))) {
$referal = Model_Users::getUser(JO_Cookie::get('referral'));
//.........这里部分代码省略.........
示例5: indexAction
public function indexAction()
{
$request = $this->getRequest();
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array('filter_status' => 1));
foreach ($categories as $category) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$this->view->categories[] = $category;
}
//////////// User Type ////////////
$this->view->user_types = array();
$user_types = Model_Users::getUserType(array('filter_status' => 1));
foreach ($user_types as $user_type) {
$user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
$this->view->user_types[] = $user_type;
}
/////////// activate //////////
$_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate');
$_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
$this->view->user_sports = array();
$users_sports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
$i = 0;
foreach ($users_sports as $user_sports) {
if ($user_sports['sport_category'] != 1) {
if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
$this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
$i++;
}
}
}
$this->view->sportcounter = $i;
$user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
$upload = new JO_Upload_SessionStore();
$upload->setName('upload_avatar');
$info = $upload->getFileInfo();
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
if ($request->issetPost('type_user')) {
if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
$validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
}
}
$validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//is_nan() sino
/*
if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
$validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
}
* */
//$validate->_set_rules($request->getPost('sport_category_1'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
$data = $request->getPost();
if ($validate->_valid_form()) {
if (Model_Users::isExistEmail($request->getPost('email'), JO_Session::get('user[email]'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'), JO_Session::get('user[username]'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$data['dont_search_index'] = (int) $request->issetPost('dont_search_index');
$data['facebook_timeline'] = (int) $request->issetPost('facebook_timeline');
if ($info) {
if (!@file_exists(BASE_PATH . '/cache/avatar/') || !is_dir(BASE_PATH . '/cache/avatar/')) {
mkdir(BASE_PATH . '/cache/avatar/');
}
$filename = BASE_PATH . '/cache/avatar/' . md5(mt_rand() . time()) . $upload->get_extension($info['name']);
if (file_put_contents($filename, $info['data'])) {
$data['avatar'] = $filename;
}
}
$new_email_key = md5(JO_Session::get('user[email]') . mt_rand() . time());
if (JO_Session::get('user[email]') != $request->getPost('email')) {
$data['new_email_key'] = $new_email_key;
} else {
$data['new_email_key'] = '';
}
$data['new_email'] = $data['email'];
unset($data['email']);
/*
$lat = $data['lat'];
$len = $data['len'];
//.........这里部分代码省略.........
示例6: registerfbAction
public function registerfbAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
$response = $this->getResponse();
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$callback = $request->getRequest('callback');
if (!preg_match('/^([a-z0-9_.]{1,})$/', $callback)) {
$callback = false;
}
$return = array();
$shared_content = Model_Users::checkSharedContent($request->getParam('key'), $request->getParam('user_id'));
//self::loginInit($fbData['id'], $session);
$ph = new WM_Facebook_Photo();
$image = $ph->getRealUrl('http://graph.facebook.com/' . $request->getPost('facebook_id') . '/picture?type=large');
if (!@getimagesize($image)) {
$image = '';
}
$this->view->error = false;
if ($request->isPost()) {
$session = $request->getPost('facebook_id');
//error_log("facebook id " . $session . " " . $request->getPost('username') . " " . $request->getPost('firstname')." ". $request->getPost('lastname'));
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
// $validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
// $validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
// $validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
if ($validate->_valid_form()) {
if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
$validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
$validate->_set_valid_form(false);
//error_log("ERROR PASSS ". $request->getPost('password') . " " . $request->getPost('password2') );
}
if (Model_Users::isExistEmail($request->getPost('email'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
//error_log("ERROR MAIL ". $request->getPost('email'));
}
if (Model_Users::isExistUsername($request->getPost('username'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
//error_log("ERROR USER ". $request->getPost('username'));
}
}
if ($validate->_valid_form()) {
$reg_key = sha1($request->getPost('email') . $request->getPost('username'));
$result = Model_Users::create(array('facebook_id' => $request->getPost('facebook_id'), 'gender' => $request->getPost('gender'), 'avatar' => $image ? $image : '', 'location' => $request->getPost('location'), 'website' => $request->getPost('website'), 'username' => $request->getPost('username'), 'firstname' => $request->getPost('firstname'), 'lastname' => $request->getPost('lastname'), 'email' => $request->getPost('email'), 'password' => $request->getPost('password'), 'delete_email' => $request->getPost('email'), 'facebook_session' => $session, 'delete_code' => isset($shared_content['if_id']) ? $shared_content['if_id'] : '', 'following_user' => isset($shared_content['user_id']) ? $shared_content['user_id'] : '', 'facebook_connect' => 1, 'confirmed' => '0', 'regkey' => $reg_key));
if ($result) {
if (self::sendMail($result)) {
//self::loginInit($result);
}
$return = array('id' => $result);
//['user_id']);
//error_log("SIN ERROR ". $result);
} else {
$return = array('error' => 3, 'description' => $this->translate('There was a problem with the record. Please try again!'));
//error_log("ERROR 3 ");
}
} else {
$return = array('error' => 4, 'description' => str_replace("<br />", ". ", $validate->_get_error_messages()));
//error_log("ERROR 4 " . str_replace("<br />", ". ", $validate->_get_error_messages()));
}
}
$this->view->user_id_fb = $request->getPost('facebook_id');
$this->view->baseUrl = $request->getBaseUrl();
if ($request->issetPost('email')) {
$this->view->email = $request->getPost('email');
} else {
$this->view->email = '';
}
if ($request->issetPost('firstname')) {
$this->view->firstname = $request->getPost('firstname');
} else {
$this->view->firstname = '';
}
//
// if($request->issetPost('lastname')) {
// $this->view->lastname = $request->getPost('lastname');
// } else {
// if(isset($fbData['last_name'])) {
// $this->view->lastname = $fbData['last_name'];
// } else {
// $this->view->lastname = '';
// }
// }
if ($request->issetPost('username')) {
$this->view->username = $request->getPost('username');
} else {
$this->view->username = '';
}
$this->view->password = $request->getPost('password');
// $this->view->password2 = $request->getPost('password2');
if ($callback) {
$return = $callback . '(' . JO_Json::encode($return) . ')';
} else {
//.........这里部分代码省略.........
示例7: indexAction
public function indexAction()
{
$request = $this->getRequest();
$user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
$upload = new JO_Upload_SessionStore();
$upload->setName('upload_avatar');
$info = $upload->getFileInfo();
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
if (JO_Session::get('connect_error')) {
$this->view->error = JO_Session::get('connect_error');
JO_Session::clear('connect_error');
}
$this->view->config_enable_follow_private_profile = Helper_Config::get('config_enable_follow_private_profile');
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$data = $request->getPost();
if ($validate->_valid_form()) {
if (Model_Users::isExistEmail($request->getPost('email'), JO_Session::get('user[email]'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'), JO_Session::get('user[username]'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$data['dont_search_index'] = (int) $request->issetPost('dont_search_index');
$data['facebook_timeline'] = (int) $request->issetPost('facebook_timeline');
/* v2.2 */
if ($this->view->config_enable_follow_private_profile) {
$data['enable_follow'] = (int) (!$request->issetPost('enable_follow'));
$data['public'] = (int) (!$request->issetPost('public'));
}
/* v2.2 */
if ($info) {
if (!@file_exists(BASE_PATH . '/cache/avatar/') || !is_dir(BASE_PATH . '/cache/avatar/')) {
mkdir(BASE_PATH . '/cache/avatar/');
}
$filename = BASE_PATH . '/cache/avatar/' . md5(mt_rand() . time()) . $upload->get_extension($info['name']);
if (file_put_contents($filename, $info['data'])) {
$data['avatar'] = $filename;
}
}
$new_email_key = md5(JO_Session::get('user[email]') . mt_rand() . time());
if (JO_Session::get('user[email]') != $request->getPost('email')) {
$data['new_email_key'] = $new_email_key;
} else {
$data['new_email_key'] = '';
}
$data['new_email'] = $data['email'];
unset($data['email']);
$result = new Model_Users_Edit(JO_Session::get('user[user_id]'), $data);
if ($result->affected_rows) {
JO_Session::set('successfu_edite', true);
$upload->getFileInfo(true);
if (JO_Session::get('user[email]') != $request->getPost('email')) {
/*$this->view->verify_email_href = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=login&user_id='.JO_Session::get('user[user_id]').'&verify=' . $new_email_key );
$this->view->user_info = $user_data;
Model_Email::send(
$request->getPost('email'),
Helper_Config::get('noreply_mail'),
$this->translate('Please verify your email'),
$this->view->render('verify_email', 'mail')
);*/
$template = Model_Notification::getTemplate('verify_email');
if ($template) {
$template_data = array('user_id' => JO_Session::get('user[user_id]'), 'user_firstname' => JO_Session::get('user[firstname]'), 'user_lastname' => JO_Session::get('user[lastname]'), 'user_fullname' => JO_Session::get('user[fullname]'), 'user_username' => JO_Session::get('user[username]'), 'verify_email_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . JO_Session::get('user[user_id]') . '&verify=' . $new_email_key), 'site_url' => $request->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'user_message' => '', 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'));
if (!$template['title']) {
$template['title'] = $this->translate('Please verify your email');
}
$title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data);
$body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data);
Model_Email::send($request->getPost('email'), Helper_Config::get('noreply_mail'), $title, $body);
}
}
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=settings'));
} else {
$this->view->error = $this->translate('There was a problem with the record. Please try again!');
}
} else {
$this->view->error = $validate->_get_error_messages();
}
foreach ($data as $k => $v) {
if (isset($user_data[$k])) {
$user_data[$k] = $v;
}
}
}
if ($info) {
$user_data['avatar'] = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=temporary_avatar&s=' . microtime(true));
$user_data['has_avatar'] = true;
} else {
//.........这里部分代码省略.........
示例8: registerAction
public function registerAction()
{
$request = $this->getRequest();
$_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
$this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array('filter_status' => 1));
foreach ($categories as $category) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$this->view->categories[] = $category;
}
//////////// User Type ////////////
$this->view->user_types = array();
$user_types = Model_Users::getUserType(array('filter_status' => 1));
foreach ($user_types as $user_type) {
$user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
$this->view->user_types[] = $user_type;
}
$this->view->user_sports = array();
$users_sports = Model_Users::getUserSports(0);
$i = 0;
foreach ($users_sports as $user_sports) {
if ($user_sports['sport_category'] != 1) {
if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
$this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
$i++;
}
}
}
//$this->view->sportcounter = $i;
if (JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')));
}
$shared_content = Model_Users::checkSharedContent($request->getParam('key'), $request->getParam('user_id'));
if (!JO_Registry::get('enable_free_registration')) {
if (!$shared_content) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
}
} else {
$this->view->fb_register = null;
$fb_ses = JO_Registry::get('facebookapi');
$session = $fb_ses->getUser();
if (JO_Registry::get('oauth_fb_key') && JO_Registry::get('oauth_fb_secret')) {
$this->view->fb_register = $this->facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=facebook&action=login'), 'req_perms' => 'email,user_birthday,status_update,user_videos,user_status,user_photos,offline_access,read_friendlists'));
}
}
if (JO_Registry::get('oauth_in_key')) {
$this->view->instagram_register = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=instagram&action=register&next=' . urlencode(WM_Router::create($request->getBaseUrl() . '?controller=instagram&action=register')));
}
$this->view->error = false;
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
$validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
if (!isset($_SESSION['token'])) {
if ($request->issetPost('type_user')) {
if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
$validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
}
}
//is_nan() sino
/* if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
$validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
} */
$validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
}
if ($validate->_valid_form()) {
if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
$validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistEmail($request->getPost('email'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$reg_key = sha1($request->getPost('email') . $request->getPost('username'));
$lat = $request->getPost('lat');
$len = $request->getPost('len');
/*
while (Model_Users::getUsersLatLen($lat, $len))
{
$posLat = strpos($lat, ".");
$longLat = strlen(substr((string) $lat, $posLat));
$cantLat = 0;
//.........这里部分代码省略.........