当前位置: 首页>>代码示例>>PHP>>正文


PHP H::valid_email方法代码示例

本文整理汇总了PHP中H::valid_email方法的典型用法代码示例。如果您正苦于以下问题:PHP H::valid_email方法的具体用法?PHP H::valid_email怎么用?PHP H::valid_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在H的用法示例。


在下文中一共展示了H::valid_email方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_email

 public function action_email($action, $email, $link, $data = array(), $server = 'master')
 {
     if (!H::valid_email($email)) {
         $user_info = $this->model('account')->get_user_info_by_uid($email);
         if ($user_info['email_settings'][$action] == 'N') {
             return false;
         }
         $email = $user_info['email'];
     }
     if (!$email) {
         return false;
     }
     $email_message = (array) AWS_APP::config()->get('email_message');
     foreach ($email_message[$action] as $key => $val) {
         ${$key} = str_replace('[#user_name#]', $data['user_name'], $val);
         ${$key} = str_replace('[#site_name#]', get_setting('site_name'), ${$key});
         foreach ($data as $k => $v) {
             ${$key} = str_replace('[#' . $k . '#]', $data[$k], ${$key});
         }
     }
     if (in_array($action, array('VALID_EMAIL', 'INVITE_REG', 'FIND_PASSWORD'))) {
         return $this->send($email, $subject, $message, $link, null, $server);
     } else {
         return $this->insert('mail_queue', array('send_to' => $email, 'subject' => $subject, 'message' => $this->get_mail_template($user_info['user_name'], $subject, $message, $link)));
     }
 }
开发者ID:wenyinos,项目名称:wecenter,代码行数:26,代码来源:email.php

示例2: invite_action

 public function invite_action()
 {
     if (!$this->user_info['email']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('当前帐号没有提供 Email, 此功能不可用')));
     }
     if (!H::valid_email($_POST['email'])) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写正确的邮箱')));
     }
     if ($this->user_info['invitation_available'] < 1) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('已经没有可使用的邀请名额')));
     }
     if ($uid = $this->model('account')->check_email($_POST['email'])) {
         if ($uid == $this->user_id) {
             H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你不能邀请自己')));
         }
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('此邮箱已在本站注册帐号')));
     }
     // 若再次填入已邀请过的邮箱,则再发送一次邀请邮件
     if ($invitation_info = $this->model('invitation')->get_active_invitation_by_email($_POST['email'])) {
         if ($invitation_info['active_status'] == 0) {
             if ($invitation_info['uid'] == $this->user_id) {
                 $this->model('invitation')->send_invitation_email($invitation_info['invitation_id']);
                 H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('重发邀请成功')));
             } else {
                 H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('此邮箱已接收过本站发出的邀请')));
             }
         }
     }
     $invitation_code = $this->model('invitation')->get_unique_invitation_code();
     if ($invitation_id = $this->model('invitation')->add_invitation($this->user_id, $invitation_code, $_POST['email'], time(), ip2long($_SERVER['REMOTE_ADDR']))) {
         $this->model('invitation')->send_invitation_email($invitation_id);
         H::ajax_json_output(AWS_APP::RSM(null, 1, null));
     }
 }
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:34,代码来源:ajax.php

示例3: add_user_data

 public function add_user_data($group_id, $email)
 {
     if (!H::valid_email($email) or $this->is_unsubscription($email)) {
         return false;
     }
     if ($this->fetch_row('edm_userdata', 'usergroup = ' . intval($group_id) . " AND email = '" . $this->quote(strtolower($email)) . "'")) {
         return false;
     }
     return $this->insert('edm_userdata', array('usergroup' => $group_id, 'email' => strtolower($email)));
 }
开发者ID:Gradven,项目名称:what3.1.7,代码行数:10,代码来源:edm.php

示例4: login

 function login($_username, $_password)
 {
     if (H::valid_email($_username)) {
         // 使用 E-mail 登录
         list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password, 2);
     }
     if ($this->ucenter_charset != 'utf-8') {
         $username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
     }
     if (!$uc_uid) {
         if ($this->ucenter_charset != 'utf-8') {
             list($uc_uid, $username, $password, $email) = uc_user_login(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password);
             if ($username) {
                 $username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
             }
         } else {
             list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password);
         }
     }
     if ($username) {
         $username = htmlspecialchars($username);
     }
     if ($uc_uid > 0) {
         if (!($user_info = $this->get_uc_user_info($uc_uid))) {
             if ($site_user_info = $this->model('account')->get_user_info_by_email($email)) {
                 $this->insert('users_ucenter', array('uid' => $site_user_info['uid'], 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
                 return false;
             }
             if ($new_user_id = $this->model('account')->user_register($username, $_password, $email, TRUE)) {
                 if ($exists_uc_id = $this->is_uc_user($email)) {
                     $this->update('users_ucenter', array('username' => $username, 'uid' => $new_user_id), 'uc_uid = ' . intval($exists_uc_id));
                 } else {
                     $this->insert('users_ucenter', array('uid' => $new_user_id, 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
                 }
                 $user_info = $this->model('account')->get_user_info_by_uid($new_user_id, true, false);
             }
         } else {
             // Update password
             $this->model('account')->update_user_password_ingore_oldpassword($_password, $user_info['uid'], $user_info['salt']);
             // Update username
             if ($user_info['user_name'] != $username) {
                 if (!$this->model('account')->check_username($username)) {
                     $this->model('account')->update_user_name($username, $user_info['uid']);
                     $this->update('users_ucenter', array('username' => htmlspecialchars($username)), 'uc_uid = ' . intval($uc_uid));
                 }
             }
         }
     }
     return $user_info;
 }
开发者ID:chenruixuan,项目名称:wecenter,代码行数:50,代码来源:ucenter.php

示例5: login

 function login($_username, $_password)
 {
     if (H::valid_email($_username)) {
         // 使用 E-mail 登录
         list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password, 2);
     }
     if ($this->ucenter_charset != 'utf-8') {
         $username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
     }
     if (!$uc_uid) {
         if ($this->ucenter_charset != 'utf-8') {
             list($uc_uid, $username, $password, $email) = uc_user_login(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password);
             if ($username) {
                 $username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
             }
         } else {
             list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password);
         }
     }
     if ($username) {
         $username = htmlspecialchars($username);
     }
     if ($uc_uid > 0) {
         if (!($user_info = $this->get_uc_user_info($uc_uid))) {
             if ($site_user_info = $this->model('account')->get_user_info_by_email($email)) {
                 $this->insert('users_ucenter', array('uid' => $site_user_info['uid'], 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
                 return false;
             }
             if ($new_user_id = $this->model('account')->user_register($username, $_password, $email, TRUE)) {
                 if ($exists_uc_id = $this->is_uc_user($email)) {
                     $this->update('users_ucenter', array('username' => $username, 'uid' => $new_user_id), 'uc_uid = ' . intval($exists_uc_id));
                 } else {
                     $this->insert('users_ucenter', array('uid' => $new_user_id, 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
                     if (uc_check_avatar($uc_uid, 'big')) {
                         $avatar = @file_get_contents(UC_API . '/avatar.php?uid=' . $uc_uid . '&size=big');
                         if ($avatar) {
                             AWS_APP::upload()->initialize(array('allowed_types' => 'jpg,jpeg,png,gif', 'upload_path' => get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($new_user_id, '', 1), 'is_image' => TRUE, 'max_size' => get_setting('upload_avatar_size_limit'), 'file_name' => $this->model('account')->get_avatar($new_user_id, '', 2), 'encrypt_name' => FALSE))->do_upload('aws_upload_file', $avatar);
                             if (!AWS_APP::upload()->get_error()) {
                                 $upload_data = AWS_APP::upload()->data();
                                 if ($upload_data) {
                                     if ($upload_data['is_image'] == 1) {
                                         foreach (AWS_APP::config()->get('image')->avatar_thumbnail as $key => $val) {
                                             $thumb_file[$key] = $upload_data['file_path'] . $this->model('account')->get_avatar($new_user_id, $key, 2);
                                             AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
                                         }
                                     }
                                     $update_data['avatar_file'] = $this->model('account')->get_avatar($new_user_id, null, 1) . basename($thumb_file['min']);
                                     // 更新主表
                                     $this->model('account')->update_users_fields($update_data, $new_user_id);
                                     if (!$this->model('integral')->fetch_log($new_user_id, 'UPLOAD_AVATAR')) {
                                         $this->model('integral')->process($new_user_id, 'UPLOAD_AVATAR', round(get_setting('integral_system_config_profile') * 0.2), '上传头像');
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $user_info = $this->model('account')->get_user_info_by_uid($new_user_id, true, false);
             }
         } else {
             // Update password
             $this->model('account')->update_user_password_ingore_oldpassword($_password, $user_info['uid'], $user_info['salt']);
             // Update username
             if ($user_info['user_name'] != $username) {
                 if (!$this->model('account')->check_username($username)) {
                     $this->model('account')->update_user_name($username, $user_info['uid']);
                     $this->update('users_ucenter', array('username' => htmlspecialchars($username)), 'uc_uid = ' . intval($uc_uid));
                 }
             }
         }
     }
     return $user_info;
 }
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:73,代码来源:ucenter.php

示例6: send_invites_action

 public function send_invites_action()
 {
     if ($_POST['email_list']) {
         if ($emails = explode("\n", str_replace("\r", "\n", $_POST['email_list']))) {
             foreach ($emails as $key => $email) {
                 if (!H::valid_email($email)) {
                     continue;
                 }
                 $email_list[] = strtolower($email);
             }
         }
     } else {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入邮箱地址')));
     }
     $this->model('invitation')->send_batch_invitations(array_unique($email_list), $this->user_id, $this->user_info['user_name']);
     H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('邀请已发送')));
 }
开发者ID:ideager,项目名称:wecenter,代码行数:17,代码来源:ajax.php

示例7: check_hash_login

 /**
  * 用户登录验证 (MD5 验证)
  *
  * @param string
  * @param string
  * @return array
  */
 public function check_hash_login($user_name, $password_md5)
 {
     if (!$user_name or !$password_md5) {
         return false;
     }
     if (H::valid_email($user_name)) {
         $user_info = $this->get_user_info_by_email($user_name);
     }
     if (!$user_info) {
         if (!($user_info = $this->get_user_info_by_username($user_name))) {
             return false;
         }
     }
     if ($password_md5 != $user_info['password']) {
         return false;
     } else {
         return $user_info;
     }
 }
开发者ID:actcms,项目名称:houziquan,代码行数:26,代码来源:account.php

示例8: email_invite_action

 public function email_invite_action()
 {
     if (!H::valid_email($_POST['email'])) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写正确的 Email')));
     }
     if ($_POST['email'] == $this->user_info['email']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你不能邀请自己')));
     }
     if ($this->model('question')->check_email_invite($_GET['question_id'], $this->user_id, $_POST['email'])) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('此 E-mail 已接收过邀请')));
     }
     $this->model('question')->add_invite($_GET['question_id'], $this->user_id, 0, $_POST['email']);
     $question_info = $this->model('question')->get_question_info_by_id($_GET['question_id']);
     $this->model('email')->action_email('INVITE_QUESTION', $_POST['email'], get_js_url('/question/' . $_GET['question_id'] . '?fromuid=' . $this->user_id), array('user_name' => $this->user_info['user_name'], 'question_title' => $question_info['question_content']));
     H::ajax_json_output(AWS_APP::RSM(null, 1, AWS_APP::lang()->_t('邀请成功')));
 }
开发者ID:tenstone,项目名称:wecenter,代码行数:16,代码来源:ajax.php

示例9: complete_profile_action

 public function complete_profile_action()
 {
     if ($this->user_info['email']) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('当前帐号已经完善资料')));
     }
     if ($check_result = $this->model('account')->check_username_char($_POST['user_name'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', $check_result));
     }
     $update_data['user_name'] = trim($_POST['user_name']);
     if (!H::valid_email($this->user_info['email'])) {
         if (!H::valid_email($_POST['email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入正确的 E-Mail 地址')));
         }
         if ($this->model('account')->check_email($_POST['email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('邮箱已经存在, 请使用新的邮箱')));
         }
         $update_data['email'] = $_POST['email'];
         $this->model('active')->new_valid_email($this->user_id, $_POST['email']);
     }
     $uid = $this->user_id;
     $user_name = $update_data['user_name'];
     $this->model('account')->update_users_fields($update_data, $this->user_id);
     $host = 'localhost';
     $username = 'root';
     $password = 'toor';
     $database = 'baji';
     $dbc = mysqli_connect($host, $username, $password, $database);
     if (!$dbc) {
         die('Could not connect: ' . mysql_error());
     }
     $query = "update fackqq set user_name = '{$user_name}' where uid = '{$uid}'";
     mysqli_query($dbc, $query) or die('Error!!');
     mysqli_close($dbc);
     $this->model('account')->update_user_password_ingore_oldpassword($_POST['password'], $this->user_id, $this->user_info['salt']);
     $this->model('account')->setcookie_login($this->user_info['uid'], $update_data['user_name'], $_POST['password'], $this->user_info['salt'], null, true, $this->user_info['group_id']);
     H::ajax_json_output(AWS_APP::RSM(null, 1, null));
 }
开发者ID:leonardo0004,项目名称:wecenter-loudong,代码行数:37,代码来源:ajax.php

示例10: complete_profile_action

 public function complete_profile_action()
 {
     if ($this->user_info['email']) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('当前帐号已经完善资料')));
     }
     $_POST['user_name'] = htmlspecialchars(trim($_POST['user_name']));
     if ($check_result = $this->model('account')->check_username_char($_POST['user_name'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', $check_result));
     }
     if ($this->user_info['user_name'] != $_POST['user_name']) {
         if ($this->model('account')->check_username_sensitive_words($_GET['username']) || $this->model('account')->check_username($_GET['username'])) {
             H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名已被注册')));
         }
     }
     $update_data['user_name'] = $_POST['user_name'];
     if (!H::valid_email($this->user_info['email'])) {
         if (!H::valid_email($_POST['email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入正确的 E-Mail 地址')));
         }
         if ($this->model('account')->check_email($_POST['email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('邮箱已经存在, 请使用新的邮箱')));
         }
         $update_data['email'] = $_POST['email'];
         $this->model('active')->new_valid_email($this->user_id, $_POST['email']);
     }
     $this->model('account')->update_users_fields($update_data, $this->user_id);
     $this->model('account')->update_user_password_ingore_oldpassword($_POST['password'], $this->user_id, $this->user_info['salt']);
     $this->model('account')->setcookie_login($this->user_info['uid'], $update_data['user_name'], $_POST['password'], $this->user_info['salt']);
     H::ajax_json_output(AWS_APP::RSM(null, 1, null));
 }
开发者ID:egogg,项目名称:wecenter-dev,代码行数:30,代码来源:ajax.php

示例11: get_user_info_by_email

 /**
  * 通过用户邮箱获取用户信息
  *
  * $cache_result 为是否缓存结果
  *
  * @param string
  * @return array
  */
 public function get_user_info_by_email($email, $cache_result = true)
 {
     if (!H::valid_email($email)) {
         return false;
     }
     if ($uid = $this->fetch_one('users', 'uid', "email = '" . $this->quote($email) . "'")) {
         return $this->get_user_info_by_uid($uid, $attrb, $cache_result);
     }
 }
开发者ID:egogg,项目名称:wecenter-dev,代码行数:17,代码来源:account.php

示例12: profile_setting_action

 public function profile_setting_action()
 {
     if (!$this->user_info['user_name'] or $this->user_info['user_name'] == $this->user_info['email'] and $_POST['user_name']) {
         $update_data['user_name'] = htmlspecialchars(trim($_POST['user_name']));
         if ($check_result = $this->model('account')->check_username_char($_POST['user_name'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', $check_result));
         }
     }
     if ($_POST['url_token'] and $_POST['url_token'] != $this->user_info['url_token']) {
         if ($this->user_info['url_token_update'] and $this->user_info['url_token_update'] > time() - 3600 * 24 * 30) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你距离上次修改个性网址未满 30 天')));
         }
         if (!preg_match("/^(?!__)[a-zA-Z0-9_]+\$/i", $_POST['url_token'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('个性网址只允许输入英文或数字')));
         }
         if ($this->model('account')->check_url_token($_POST['url_token'], $this->user_id)) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('个性网址已经被占用请更换一个')));
         }
         if (preg_match("/^[\\d]+\$/i", $_POST['url_token'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('个性网址不允许为纯数字')));
         }
         $this->model('account')->update_url_token($_POST['url_token'], $this->user_id);
     }
     if ($update_data['user_name'] and $this->model('account')->check_username($update_data['user_name']) and $this->user_info['user_name'] != $update_data['user_name']) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已经存在相同的姓名, 请重新填写')));
     }
     if (!H::valid_email($this->user_info['email'])) {
         if (!H::valid_email($_POST['email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入正确的 E-Mail 地址')));
         }
         if ($this->model('account')->check_email($_POST['email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('邮箱已经存在, 请使用新的邮箱')));
         }
         $update_data['email'] = $_POST['email'];
         $this->model('active')->new_valid_email($this->user_id, $_POST['email']);
     }
     if ($_POST['common_email']) {
         if (!H::valid_email($_POST['common_email'])) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入正确的常用邮箱地址')));
         }
         $update_data['common_email'] = $_POST['common_email'];
     }
     $update_data['sex'] = intval($_POST['sex']);
     $update_data['province'] = htmlspecialchars($_POST['province']);
     $update_data['city'] = htmlspecialchars($_POST['city']);
     if ($_POST['birthday_y']) {
         $update_data['birthday'] = intval(strtotime(intval($_POST['birthday_y']) . '-' . intval($_POST['birthday_m']) . '-' . intval($_POST['birthday_d'])));
     }
     if (!$this->user_info['verified']) {
         $update_attrib_data['signature'] = htmlspecialchars($_POST['signature']);
     }
     $update_data['job_id'] = intval($_POST['job_id']);
     if ($_POST['signature'] and !$this->model('integral')->fetch_log($this->user_id, 'UPDATE_SIGNATURE')) {
         $this->model('integral')->process($this->user_id, 'UPDATE_SIGNATURE', round(get_setting('integral_system_config_profile') * 0.1), AWS_APP::lang()->_t('完善一句话介绍'));
     }
     $update_attrib_data['qq'] = htmlspecialchars($_POST['qq']);
     $update_attrib_data['homepage'] = htmlspecialchars($_POST['homepage']);
     $update_data['mobile'] = htmlspecialchars($_POST['mobile']);
     if (($update_attrib_data['qq'] or $update_attrib_data['homepage'] or $update_data['mobile']) and !$this->model('integral')->fetch_log($this->user_id, 'UPDATE_CONTACT')) {
         $this->model('integral')->process($this->user_id, 'UPDATE_CONTACT', round(get_setting('integral_system_config_profile') * 0.1), AWS_APP::lang()->_t('完善联系资料'));
     }
     if (get_setting('auto_create_social_topics') == 'Y') {
         if ($_POST['city']) {
             $this->model('topic')->save_topic($_POST['city']);
         }
         if ($_POST['province']) {
             $this->model('topic')->save_topic($_POST['province']);
         }
     }
     // 更新主表
     $this->model('account')->update_users_fields($update_data, $this->user_id);
     // 更新从表
     $this->model('account')->update_users_attrib_fields($update_attrib_data, $this->user_id);
     //$this->model('account')->set_default_timezone($_POST['default_timezone'], $this->user_id);
     H::ajax_json_output(AWS_APP::RSM(AWS_APP::lang()->_t('个人资料保存成功'), 1, null));
 }
开发者ID:nerverwind,项目名称:wecenter_ios_sdk,代码行数:76,代码来源:people.php

示例13: login

 function login($_username, $_password)
 {
     if (H::valid_email($_username)) {
         // 使用 E-mail 登录
         list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password, 2);
     }
     if ($this->ucenter_charset != 'utf-8') {
         $username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
     }
     if (!$uc_uid) {
         if ($this->ucenter_charset != 'utf-8') {
             list($uc_uid, $username, $password, $email) = uc_user_login(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password);
             if ($username) {
                 $username = convert_encoding($username, $this->ucenter_charset, 'UTF-8');
             }
         } else {
             list($uc_uid, $username, $password, $email) = uc_user_login($_username, $_password);
         }
     }
     if ($username) {
         $username = htmlspecialchars($username);
     }
     if ($uc_uid > 0) {
         if ($user_info = $this->get_uc_user_info($uc_uid)) {
             // Update password
             $this->model('account')->update_user_password_ingore_oldpassword($_password, $user_info['uid'], $user_info['salt']);
             // Update username
             if ($user_info['user_name'] != $username) {
                 if (!$this->model('account')->check_username($username)) {
                     $this->model('account')->update_user_name($username, $user_info['uid']);
                     $this->update('users_ucenter', array('username' => htmlspecialchars($username)), 'uc_uid = ' . intval($uc_uid));
                 }
             }
         } else {
             if ($site_user_info = $this->model('account')->get_user_info_by_email($email)) {
                 $this->insert('users_ucenter', array('uid' => $site_user_info['uid'], 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
                 return false;
             }
             if ($new_user_id = $this->model('account')->user_register($username, $_password, $email, TRUE)) {
                 if ($exists_uc_id = $this->is_uc_user($email)) {
                     $this->update('users_ucenter', array('username' => $username, 'uid' => $new_user_id), 'uc_uid = ' . intval($exists_uc_id));
                 } else {
                     $this->insert('users_ucenter', array('uid' => $new_user_id, 'uc_uid' => $uc_uid, 'username' => $username, 'email' => $email));
                 }
                 $user_info = $this->model('account')->get_user_info_by_uid($new_user_id, true, false);
             }
         }
     }
     if (uc_check_avatar($uc_uid, 'big')) {
         if (!$user_info['avatar_file']) {
             $this->model('account')->associate_remote_avatar($user_info['uid'], UC_API . '/avatar.php?uid=' . $uc_uid . '&size=big');
         }
     } else {
         if ($user_info['avatar_file'] and get_setting('ucenter_path')) {
             $avatar = get_setting('upload_dir') . '/avatar/' . $this->model('account')->get_avatar($user_info['uid'], '');
             $uc_avatar_dir = get_setting('ucenter_path') . '/data/avatar/' . $this->model('account')->get_avatar($uc_uid, '', 1);
             if (!file_exists($uc_avatar_dir)) {
                 make_dir($uc_avatar_dir);
             }
             foreach (AWS_APP::config()->get('image')->uc_avatar_thumbnail as $key => $val) {
                 AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $avatar, 'new_image' => $uc_avatar_dir . $this->model('account')->get_avatar($uc_uid, $key, 2), 'width' => $val['w'], 'height' => $val['h']))->resize();
             }
         }
     }
     return $user_info;
 }
开发者ID:Gradven,项目名称:what3.1.7,代码行数:66,代码来源:ucenter.php


注:本文中的H::valid_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。