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


PHP Members::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Members();
     $memberProfileModel = new MemberProfile();
     $dataProvider = new CActiveDataProvider('Members');
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Members'])) {
         $post_member = $_POST['Members'];
         $post_member_profile = $_POST['MemberProfile'];
         $password = $post_member['pr_member_password'];
         $email = $post_member['pr_member_email'];
         $model->pr_username = $post_member['pr_username'];
         $model->pr_member_email = $email;
         $model->pr_member_password = $model->generaSalt($password);
         //$model->pr_member_password="2123";
         $model->pr_roles_id = $post_member['pr_roles_id'];
         $model->pr_member_data_register = date('Y-m-d');
         $model->pr_member_active = 0;
         $model->pr_member_status = 1;
         $model->pr_member_rand_key = $model->generaSalt($email);
         if (Members::model()->evalPasswordStrength($password) === true) {
             if ($model->save()) {
                 $memberProfileModel->pr_member_profile_display_name = $post_member_profile['pr_member_profile_display_name'];
                 $memberProfileModel->pr_member_profile_images = "/images/no-user.png";
                 $memberProfileModel->pr_member_id = $model->pr_primary_key;
                 $memberProfileModel->save();
                 $this->redirect($this->createUrl('index'), array('dataProvider' => $dataProvider));
             }
         }
     } else {
         $this->render('create', array('model' => $model, 'memberProfileModel' => $memberProfileModel));
     }
 }
开发者ID:thongnv90,项目名称:bluesms,代码行数:38,代码来源:DefaultController.php

示例2: addMember

 public function addMember()
 {
     $member = new Members();
     $member->name = Input::get('name');
     $member->surname = Input::get('surname');
     $member->email = Input::get('email');
     $member->photo = "/daily/public/uploads/about.jpg";
     $member->password = Hash::make(Input::get('password'));
     $member->save();
     $message = "Üye kaydınız başarıyla gerçekleştirildi.";
     return View::make('login', array('message' => $message));
 }
开发者ID:mitap45,项目名称:Daily,代码行数:12,代码来源:MemberController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Members();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Members'])) {
         $model->attributes = $_POST['Members'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->memberID));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:reubsc,项目名称:sds,代码行数:17,代码来源:MembersController.php

示例4: actionadduser

 /**
  * Add user action
  */
 public function actionadduser()
 {
     // Perms
     if (!Yii::app()->user->checkAccess('op_users_add_users')) {
         throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section'));
     }
     $model = new Members();
     if (isset($_POST['Members'])) {
         $model->attributes = $_POST['Members'];
         $model->scenario = 'register';
         if ($model->save()) {
             // Loop through the roles and assign them
             $types = array('roles', 'tasks', 'operations');
             $lastID = Yii::app()->db->lastInsertID;
             foreach ($types as $type) {
                 if (isset($_POST[$type]) && count($_POST[$type])) {
                     foreach ($_POST[$type] as $others) {
                         // assign if not assigned yet
                         if (!Yii::app()->authManager->isAssigned($others, $lastID)) {
                             $authItem = Yii::app()->authManager->getAuthItem($others);
                             Yii::app()->authManager->assign($others, $lastID, $authItem->bizrule, $authItem->data);
                         }
                     }
                 }
             }
             Yii::app()->user->setFlash('success', Yii::t('adminmembers', 'User Added.'));
             $this->redirect(array('members/viewuser', 'id' => $model->id));
         }
     }
     $temp = Yii::app()->authManager->getAuthItems();
     $items = array(CAuthItem::TYPE_ROLE => array(), CAuthItem::TYPE_TASK => array(), CAuthItem::TYPE_OPERATION => array());
     if (count($temp)) {
         foreach ($temp as $item) {
             $items[$item->type][$item->name] = $item->name;
         }
     }
     $items_selected = array();
     $items_selected['roles'] = isset($_POST['roles']) ? $_POST['roles'] : '';
     $items_selected['tasks'] = isset($_POST['tasks']) ? $_POST['tasks'] : '';
     $items_selected['operations'] = isset($_POST['operations']) ? $_POST['operations'] : '';
     $this->breadcrumbs[Yii::t('adminmembers', 'Adding User')] = '';
     $this->pageTitle[] = Yii::t('adminmembers', 'Adding User');
     // Display form
     $this->render('user_form', array('items_selected' => $items_selected, 'items' => $items, 'model' => $model, 'label' => Yii::t('adminmembers', 'Adding User')));
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:48,代码来源:MembersController.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Members();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Members'])) {
         $model->attributes = $_POST['Members'];
         $dob_year = $_POST['Members']['dob_year'];
         $dob_month = $_POST['Members']['dob_month'];
         $dob_day = $_POST['Members']['dob_day'];
         $model->dob = $dob_year . "/" . $dob_month . "/" . $dob_day;
         $model->slug = $model->first_name . "-" . $model->last_name . "-" . $model->nickname;
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:roycocup,项目名称:stargym,代码行数:22,代码来源:MembersController.php

示例6: actionindex

 /**
  * Register action
  */
 public function actionindex()
 {
     $model = new RegisterForm();
     if (isset($_POST['RegisterForm'])) {
         $model->attributes = $_POST['RegisterForm'];
         if ($model->validate()) {
             // Save the member and redirect
             $user = new Members();
             $user->scenario = 'register';
             $user->role = 'member';
             $user->attributes = $_POST['RegisterForm'];
             $user->save();
             // Redirect
             Yii::app()->user->setFlash('success', Yii::t('register', 'Registration Completed. Please sign in.'));
             $this->redirect('login/index');
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:22,代码来源:RegisterController.php

示例7: createAction

 /**
  * Create a hotel
  */
 public function createAction()
 {
     $this->view->Title = "Add member";
     $this->view->headTitle($this->view->Title);
     //$Member = Members::getById ( $this->getRequest ()->getParam ( 'id' ) );
     $Member = new Members();
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest()->getParams();
         $error = self::_checkform($request);
         if (!$error) {
             $Member->merge($request);
             $Member->username = $Member->email;
             $Member->encodePassword();
             $Member->created_date = date('Y-m-d H:i:s');
             $Member->save();
             $this->Member->log('Add member:' . $Member->getName() . '(' . $Member->id . ')', 'Member');
             My_Plugin_Libs::setSplash('Member:<b>' . $Member->getName() . '</b>has been more successful.');
             $this->_redirect($this->_helper->url('index', 'member', 'admin'));
         } else {
             $this->view->error = $error;
         }
     }
     $this->view->Member = $Member;
 }
开发者ID:hoaitn,项目名称:base-zend,代码行数:27,代码来源:MemberController.php

示例8: flash

setvar("MembergroupOptions", $membergroup->getUsergroups());
setvar("Membergroups", $member_groups = $G['membergroup']);
setvar("Membertypes", $member_types = $_PB_CACHE['membertype']);
$genders = $typeoption->get_cache_type("gender");
foreach ($G['trusttype'] as $key => $val) {
    $tmp_trusttypes[$key] = $val['name'];
}
setvar("Trusttypes", $tmp_trusttypes);
if (isset($_POST)) {
    if (isset($_POST['del'])) {
        $member->Delete($_POST['id']);
        flash("success");
    }
    if (isset($_POST['check_in'])) {
        $vals['status'] = 1;
        if (!$member->save($vals, "update", $member_id)) {
            flash();
        }
    }
    if (isset($_POST['check_out'])) {
        $vals['status'] = 0;
        if (!$member->save($vals, "update", $member_id)) {
            flash();
        }
    }
    if (isset($_POST['export']) && !empty($_POST['id'])) {
        $result = $pdb->GetArray("SELECT m.*,mf.first_name,mf.last_name,mf.gender,mf.tel,mf.fax,mf.mobile,mf.address,mf.zipcode FROM {$tb_prefix}members m LEFT JOIN {$tb_prefix}memberfields mf ON m.id=mf.member_id WHERE m.id IN (" . implode(",", $_POST['id']) . ")");
        if (!empty($result)) {
            require_once LIB_PATH . "excel_export.class.php";
            $excel = new excel_xml();
            $header_style = array('bold' => 1, 'size' => '10', 'color' => '#FFFFFF', 'bgcolor' => '#4F81BD');
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:member.php

示例9: implode

         $vals['permissions'] = implode(",", $_POST['priv']);
     }
 } else {
     $vals['permissions'] = '';
 }
 if (!empty($_POST['data']['adminer']['user_pass'])) {
     $vals['user_pass'] = $member->authPasswd($_POST['data']['adminer']['user_pass']);
 }
 $adminer->primaryKey = "member_id";
 if (!empty($_POST['data']['expired'])) {
     include LIB_PATH . "time.class.php";
     $vals['expired'] = Times::dateConvert($_POST['data']['expired']);
 }
 if (!empty($_POST['member_id'])) {
     $member_id = intval($_POST['member_id']);
     $member->save($_POST['data']['member'], "update", $member_id);
     //update role
     $result = $adminer->save($vals, "update", $member_id);
     if (!$pdb->Execute("UPDATE {$tb_prefix}roleadminers SET adminrole_id='" . $_POST['data']['adminrole_id'] . "' WHERE adminer_id='" . $member_id . "'")) {
         $pdb->Execute("INSERT INTO {$tb_prefix}roleadminers (adminrole_id,adminer_id) VALUES ('" . $_POST['data']['adminrole_id'] . "','" . $member_id . "')");
     }
 } else {
     //search member_id
     if (!empty($_POST['data']['username'])) {
         $sql = "SELECT id FROM {$tb_prefix}members WHERE username='" . $_POST['data']['username'] . "'";
         $member_id = $pdb->GetOne($sql);
         if ($member_id) {
             $vals['member_id'] = $member_id;
             //add role
             $result = $adminer->save($vals);
             $pdb->Execute("INSERT INTO {$tb_prefix}roleadminers (adminrole_id,adminer_id) VALUES ('" . $_POST['data']['adminrole_id'] . "','" . $member_id . "')");
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:adminer.php

示例10: actionDoRegister

 public function actionDoRegister()
 {
     $name = Yii::app()->request->getPost('name');
     $resident = Yii::app()->request->getPost('resident');
     $password1 = Yii::app()->request->getPost('password1');
     $password2 = Yii::app()->request->getPost('password2');
     if (!$name) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '姓名不能为空'));
     } else {
         if (strlen($name) > 15) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '姓名太长不能超过15个字符'));
         }
     }
     if (!$password1 || !$password2) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '密码不能为空'));
     } else {
         if (strlen($password1) > 15 || strlen($password2) > 15) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '两次密码不能超过15个字符'));
         } else {
             if ($password1 !== $password2) {
                 $this->errorOutput(array('errorCode' => 1, 'errorText' => '两次密码不相符'));
             }
         }
     }
     //判断该用户是不是已经存在了
     $_member = Members::model()->find('name=:name', array(':name' => $name));
     if ($_member) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '该用户已经存在'));
     }
     //随机长生一个干扰码
     $salt = Common::getGenerateSalt();
     $model = new Members();
     $model->name = $name;
     $model->salt = $salt;
     $model->password = md5($salt . $password1);
     $model->create_time = time();
     $model->update_time = time();
     $model->resident = $resident;
     if ($model->save()) {
         $model->order_id = $model->id;
         $model->save();
         $this->output(array('success' => 1, 'successText' => '注册成功'));
     } else {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '注册失败'));
     }
 }
开发者ID:elite-lcf,项目名称:mictfood,代码行数:46,代码来源:SiteController.php

示例11: unset

    if (empty($_POST['member']['email'])) {
        unset($vals['email']);
    }
    if (!empty($_FILES['photo']['name'])) {
        $attachment->upload_dir = "profile" . DS . gmdate("Y") . gmdate("m") . DS . gmdate("d");
        $attachment->insert_new = false;
        $attachment->if_orignal = false;
        $attachment->if_watermark = false;
        $attachment->rename_file = "photo-" . $the_memberid;
        $attachment->upload_process();
        $vals['photo'] = $attachment->file_full_url;
    }
    $_POST['memberfield']['area_id'] = PbController::getMultiId($_POST['area']['id']);
    unset($vals['created']);
    unset($_POST['memberfield']['created']);
    $result = $member->save($vals, "update", $the_memberid);
    $memberfield->primaryKey = "member_id";
    $result = $memberfield->save($_POST['memberfield'], "update", $the_memberid);
    $member->clearCache($the_memberid);
    $member->updateMemberCaches($the_memberid);
    if (isset($_POST['personal']['resume_status'])) {
        $result = $pdb->Execute("REPLACE INTO {$tb_prefix}personals (member_id,resume_status,max_education) VALUE (" . $the_memberid . ",'" . $_POST['personal']['resume_status'] . "','" . $_POST['personal']['max_education'] . "')");
    }
    if (!$result) {
        flash('action_failed');
    } else {
        flash('success');
    }
}
unset($G['typeoption']['gender'][-1]);
setvar("Genders", $G['typeoption']['gender']);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:personal.php

示例12: postRegister

 public function postRegister()
 {
     $agent = Input::get('agent');
     if ($agent == 1) {
         try {
             $Users = Sentry::getUserProvider()->create(array('email' => Input::get('email'), 'password' => Input::get('password'), 'group' => 1, 'last_name' => Input::get('last_name')));
         } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
             return Redirect::to('user/register')->with('errors', 'email field is required');
         } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
             return Redirect::to('user/register')->with('errors', 'Password field is required');
         } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
             return Redirect::to('user/register')->withInput()->with('errors', 'User with this login already exists');
         }
         $user = Sentry::findUserByLogin(Input::get('email'));
         $activationCode = $Users->getActivationCode();
         if ($activationCode) {
             $URL = "New Agent Register To Zameen.jayedad.com.pk";
             $this->sendTo('registation@zameenjayedad.com.pk', array('activationCode' => $URL));
         }
         $agency_id = DB::table('agent')->insertGetId(array('agent_id' => $user->id, 'city' => Input::get('cities'), 'agency_name' => Input::get('agency'), 'description' => Input::get('services'), 'company_phone' => Input::get('company_phone'), 'company_mobile' => Input::get('company_mobile'), 'company_address' => Input::get('company_address'), 'company_email' => Input::get('company_email')));
         $fields = array('staff_id' => $Users->id, 'owner_id' => $Users->id, 'agency_id' => $agency_id, 'email' => Input::get('email'), 'name' => Input::get('name'), 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'address' => Input::get('address'), 'country' => Input::get('country'));
         DB::table('Agencystaff')->insert($fields);
         $fields = array('user_id' => $user->id, 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'name' => Input::get('name'), 'address' => Input::get('address'), 'photo' => Input::file('photo'), 'country' => Input::get('country'), 'roles' => Input::get('roles'), 'city' => Input::get('cities'), 'agent' => Input::get('agent'), 'agency_name' => Input::get('agency'), 'description' => Input::get('services'), 'company_phone' => Input::get('company_phone'), 'company_mobile' => Input::get('company_mobile'), 'company_address' => Input::get('company_address'), 'company_email' => Input::get('company_email'));
         $rules = array('phone' => 'required', 'cell' => 'required', 'address' => 'required', 'photo' => 'required');
         $v = Validator::make($fields, $rules);
         if ($v->fails()) {
             return Redirect::to('user/register')->with('errors', $v);
         }
         $members = new Members();
         $members->phone = $fields['phone'];
         $members->cell = $fields['cell'];
         $members->address = $fields['address'];
         $members->country = $fields['country'];
         $members->roles = $fields['roles'];
         $members->user_id = $fields['user_id'];
         $members->name = $fields['name'];
         $members->photo = $this->ImageCrop('photo', 'photos', '200', '200', '');
         $members->save();
         return Redirect::to('login')->with('errors', 'Email has been sent to representative for your Authentication');
     } else {
         try {
             $Users = Sentry::getUserProvider()->create(array('email' => Input::get('email'), 'password' => Input::get('password'), 'group' => 0, 'last_name' => Input::get('last_name')));
         } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
             return Redirect::to('user/register')->with('errors', 'email field is required');
         } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
             return Redirect::to('user/register')->with('errors', 'Password field is required');
         } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
             return Redirect::to('user/register')->withInput()->with('errors', 'User with this login already exists');
         }
         $user = Sentry::findUserByLogin(Input::get('email'));
         $activationCode = $Users->getActivationCode();
         if ($activationCode) {
             $URL = 'http://' . $_SERVER['HTTP_HOST'] . "/user/activation?code=" . $activationCode . "&email=" . Input::get('email');
             $this->sendTo(Input::get('email'), array('activationCode' => $URL));
             // return Redirect::to('user/register')->with('success','Email has been sent to you');
         }
     }
     $fields = array('user_id' => $user->id, 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'name' => Input::get('name'), 'address' => Input::get('address'), 'photo' => Input::file('photo'), 'country' => Input::get('country'), 'roles' => Input::get('roles'), 'city' => Input::get('cities'), 'agent' => Input::get('agent'), 'agency_name' => Input::get('agency'), 'description' => Input::get('services'), 'company_phone' => Input::get('company_phone'), 'company_mobile' => Input::get('company_mobile'), 'company_address' => Input::get('company_address'), 'company_email' => Input::get('company_email'));
     $rules = array('phone' => 'required', 'cell' => 'required', 'address' => 'required', 'photo' => 'required');
     $v = Validator::make($fields, $rules);
     if ($v->fails()) {
         return Redirect::to('user/register')->with('errors', $v);
     }
     $members = new Members();
     $members->phone = $fields['phone'];
     $members->cell = $fields['cell'];
     $members->address = $fields['address'];
     $members->country = $fields['country'];
     $members->roles = $fields['roles'];
     $members->user_id = $fields['user_id'];
     $members->name = $fields['name'];
     $members->photo = $this->ImageCrop('photo', 'photos', '200', '200', '');
     $members->save();
     return Redirect::to('login')->with('errors', 'please check your mail for activation');
 }
开发者ID:omusico,项目名称:zameenJayedad,代码行数:75,代码来源:AuthController.php

示例13: unset

if (isset($_POST['save'])) {
    pb_submit_check('member');
    $vals['office_redirect'] = $_POST['member']['office_redirect'];
    $vals['email'] = $_POST['member']['email'];
    if (empty($_POST['member']['email'])) {
        unset($vals['email']);
    }
    if (!empty($_FILES['photo']['name'])) {
        $attachment->insert_new = false;
        $attachment->if_orignal = false;
        $attachment->if_watermark = false;
        $attachment->rename_file = "photo-" . $_SESSION['MemberID'];
        $attachment->upload_process();
        $vals['photo'] = $attachment->file_full_url;
    }
    $result = $member->save($vals, "update", $_SESSION['MemberID']);
    $memberfield->primaryKey = "member_id";
    $result = $memberfield->save($_POST['memberfield'], "update", $_SESSION['MemberID']);
    $member->clearCache($_SESSION['MemberID']);
    if (isset($_POST['personal']['resume_status'])) {
        $result = $pdb->Execute("REPLACE INTO {$tb_prefix}personals (member_id,resume_status,max_education) VALUE (" . $_SESSION['MemberID'] . ",'" . $_POST['personal']['resume_status'] . "','" . $_POST['personal']['max_education'] . "')");
    }
    if (!$result) {
        flash('action_failed');
    } else {
        flash('success');
    }
}
setvar("Genders", $typeoption->get_cache_type('gender', null, array(-1)));
setvar("Educations", $typeoption->get_cache_type('education'));
setvar("OfficeRedirects", explode(",", L("office_redirects", "tpl")));
开发者ID:vuong93st,项目名称:w-game,代码行数:31,代码来源:personal.php

示例14: actionFacebookLogin

 /**
  * Facebook login page
  */
 public function actionFacebookLogin()
 {
     // Load facebook
     Yii::import('ext.facebook.facebookLib');
     $facebook = new facebookLib(array('appId' => Yii::app()->params['facebookappid'], 'secret' => Yii::app()->params['facebookapisecret'], 'cookie' => true, 'disableSSLCheck' => false));
     facebookLib::$CURL_OPTS[CURLOPT_CAINFO] = Yii::getPathOfAlias('ext.facebook') . '/ca-bundle.crt';
     // Do we have an access token?
     if (($session = $facebook->getSession()) || isset($_GET['session']) && $_GET['session']) {
         $info = array('id' => 0, 'email' => '');
         $info = $facebook->getInfo(null, array('access_token' => $session['access_token']));
         // Did we submit the authenticate form?
         $facebookForm = new facebookForm();
         if (isset($_POST['facebookForm'])) {
             $facebookForm->attributes = $_POST['facebookForm'];
             if ($facebookForm->validate()) {
                 // Member authenticated
                 $identity = new InternalIdentity($facebookForm->email, $facebookForm->password);
                 if ($identity->authenticate()) {
                     // Member authenticated, Login
                     Yii::app()->user->login($identity, Yii::app()->params['loggedInDays'] * 60 * 60 * 24);
                 } else {
                     Yii::app()->user->setFlash('success', $identity->errorMessage);
                 }
                 // Update the fbuid and update the token
                 // We got through save the a new token
                 Members::model()->updateByPk($identity->getId(), array('fbuid' => $info['id'], 'fbtoken' => $session['access_token']));
                 // Login & redirect
                 Yii::app()->user->setFlash('success', Yii::t('login', 'Thank You. You are now logged in.'));
                 //$this->render('facebookdone', array( 'link' => $this->createUrl('/index', array( 'lang' => false ) ) ) );
                 $this->redirect('/index');
             }
         }
         // Did we submit the signup form?
         $facebookSignForm = new Members();
         if (isset($_POST['Members'])) {
             $facebookSignForm->attributes = $_POST['Members'];
             $facebookSignForm->role = 'member';
             $facebookSignForm->scenario = 'register';
             if ($facebookSignForm->save()) {
                 $identity = new InternalIdentity($facebookSignForm->email, $_POST['Members']['password']);
                 if ($identity->authenticate()) {
                     // Member authenticated, Login
                     Yii::app()->user->login($identity, Yii::app()->params['loggedInDays'] * 60 * 60 * 24);
                 } else {
                     Yii::app()->user->setFlash('success', $identity->errorMessage);
                 }
                 // Update the fbuid and update the token
                 // We got through save the a new token
                 Members::model()->updateByPk($facebookSignForm->id, array('fbuid' => $info['id'], 'fbtoken' => $session['access_token']));
                 // Login & redirect
                 Yii::app()->user->setFlash('success', Yii::t('login', 'Thank You. You are now logged in.'));
                 //$this->render('facebookdone', array( 'link' => $this->createUrl('/index', array( 'lang' => false ) ) ) );
                 $this->redirect('/index');
             }
         }
         // Authenticate
         $identity = new facebookIdentity($info['id'], $info['email']);
         $auth = $identity->authenticate();
         // What did we discover?
         if ($identity->errorCode == facebookIdentity::ERROR_UNKNOWN_IDENTITY) {
             // fbuid was not found in the DB
             Yii::app()->user->setFlash('attention', Yii::t('login', 'We could not find any user associated with that facebook account in our records.'));
         } else {
             if ($identity->errorCode == facebookIdentity::ERROR_USERNAME_INVALID) {
                 // Email addresses did not match
                 Yii::app()->user->setFlash('attention', Yii::t('login', 'We found a user account associated with your facebook account, But the email used there is different, Please complete the form below to login as that user.'));
             } else {
                 // We got through save the a new token
                 Yii::app()->user->login($identity, Yii::app()->params['loggedInDays'] * 60 * 60 * 24);
                 Members::model()->updateByPk($identity->getId(), array('fbtoken' => $session['access_token']));
                 Yii::app()->user->setFlash('success', Yii::t('login', 'Thank You. You are now logged in.'));
                 $this->render('facebookdone', array('link' => $this->createUrl('/index', array('lang' => false))));
                 //$this->redirect('/index');
             }
         }
         // Redirect if haven't done so
         if (!isset($_GET['facebookRedirected'])) {
             $_GET['facebookRedirected'] = 'true';
             $this->render('facebookdone', array('link' => $this->createUrl('/login/facebooklogin', array_merge($_GET, array('lang' => false)))));
         }
         // Default values
         $facebookForm->email = $facebookForm->email ? $facebookForm->email : $info['email'];
         $facebookSignForm->email = $facebookSignForm->email ? $facebookSignForm->email : $info['email'];
         $facebookSignForm->username = $facebookSignForm->username ? $facebookSignForm->username : $info['name'];
         $this->render('facebook_login', array('facebookSignForm' => $facebookSignForm, 'facebookForm' => $facebookForm, 'info' => $info));
     } else {
         $this->redirect('/login');
     }
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:92,代码来源:LoginController.php

示例15: newMember

 public function newMember($socialData = null)
 {
     $this->view->disable();
     $member = new Members();
     $member->created = date('Y-m-d H:i:s');
     $member->modified = date('Y-m-d H:i:s');
     $member->first_name = $socialData['first_name'];
     $member->last_name = $socialData['last_name'];
     $member->gender = $socialData['gender'];
     $member->birthday = $socialData['birthday'];
     $member->city = $socialData['city'];
     $member->email = $socialData['email'];
     $member->type = 'Member';
     if ($member->save()) {
         return $member->id;
     }
 }
开发者ID:hinjanobara,项目名称:mbimages,代码行数:17,代码来源:MemberController.php


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