コード例 #1
0
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $count = (int) $arguments['count'];
     for ($i = 0; $i < $count; ++$i) {
         $m = new Member();
         $m->is_active = 1;
         $m->save();
         $name = "DO民ID:" . $m->id;
         $m->name = $name;
         $m->save();
     }
 }
コード例 #2
0
  protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);

    $n = (int)$options['number'];
    $link = $options['link'];
    if (!is_null($link))
    {
      $linkMember = Doctrine::getTable('Member')->find($link);
      if (!$linkMember)
      {
        throw new Exception("not found member: ".$link);
      }
    }

    for ($i = 0; $i < $n; $i++)
    {
      $member = new Member();
      $member->setName('dummy');
      $member->setIsActive(self::fetchRandomNotActive($options['notactivemember-rate'], $n));
      $member->save();

      $member->setName(sprintf($options['name-format'], $member->getId()));
      $member->save();

      $address = sprintf($options['mail-address-format'], $member->getId());
      $member->setConfig('pc_address', $address);
      $member->setConfig('mobile_address', $address);

      $password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
      $member->setConfig('password', md5($password));

      $this->logSection('member+', $member->getName());
      if (isset($linkMember))
      {
        $memberRelationship1 = new MemberRelationship();
        $memberRelationship1->setMember($member);
        $memberRelationship1->setMemberRelatedByMemberIdFrom($linkMember);
        $memberRelationship1->setIsFriend(true);
        $memberRelationship1->save();

        $memberRelationship2 = new MemberRelationship();
        $memberRelationship2->setMember($linkMember);
        $memberRelationship2->setMemberRelatedByMemberIdFrom($member);
        $memberRelationship2->setIsFriend(true);
        $memberRelationship2->save();
        $this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
      }
    }
  }
 public function create_post()
 {
     $this->layout = '';
     $rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'email|unique:members,email', 'photo' => 'mimes:jpeg,bmp,png|max:200', 'dob' => 'date_format:Y-m-d');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('members/create')->withInput()->withErrors($validator);
     } else {
         $filename = '';
         if (Input::hasFile('photo')) {
             $file = Input::file('photo');
             $filename = Input::file('photo')->getClientOriginalName();
             $extension = substr(strrchr($filename, '.'), 1);
             $newname = strtolower(md5(date("Y-m-d") . Input::get('username')) . '.' . $extension);
             $uploadStatus = Input::file('photo')->move(Config::get('app.upload_path'), $newname);
             if ($uploadStatus) {
                 $filename = $newname;
             }
         }
         $member = new Member();
         $member->number = date("YmdHis");
         $member->first_name = Input::get('first_name');
         $member->last_name = Input::get('last_name');
         $member->address = Input::get('address');
         $member->phone = Input::get('phone');
         $member->dob = Input::get('dob');
         $member->email = Input::get('email');
         $member->photo = $filename;
         $member->save();
         return Redirect::to('members/create')->with('success', 'Member has been created.');
     }
 }
コード例 #4
0
ファイル: UserController.php プロジェクト: Dvionst/vvfy
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $user = new User();
     $member = new Member();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['User'], $_POST['Member'])) {
         $user->attributes = $_POST['User'];
         $user->repeat_password = $_POST['User']['repeat_password'];
         $member->attributes = $_POST['Member'];
         $member->type_account = $_POST['Member']['type_account'];
         $user->scenario = 'register';
         $member->scenario = 'register';
         $user->level = 3;
         $valid = $user->validate();
         $valid = $member->validate() && $valid;
         if ($valid) {
             $email = explode("@", $user->username);
             $member->name = $email[0];
             $member->email = $user->username;
             $member->date_register = new CDbExpression('NOW()');
             $member->code = strtoupper(substr(md5(uniqid(rand(), true)), 0, 5));
             $getToken = rand(0, 99999);
             $getTime = date("H:i:s");
             $user->token = md5($getToken . $getTime);
             $user->save();
             $member->save();
             MemberController::SendMail($member->email, $member->name, $member->code, $user->token);
             echo CJSON::encode(array('reg' => 'success', 'redirect' => $this->createUrl(array('land/userme')), 'email' => $member->email));
         } else {
             echo CJSON::encode(array('reg' => 'failed', 'email' => str_replace('Username', 'Email', CHtml::error($user, 'username')), 'username' => str_replace('Name', 'Username', CHtml::error($member, 'name')), 'password' => CHtml::error($user, 'password'), 'repeat_password' => CHtml::error($user, 'repeat_password'), 'all' => Chtml::errorSummary(array($user, $member))));
         }
     }
 }
コード例 #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Responsef81a482d8069a749bd141a2efa68de7d
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Member::$rules);
     var_dump(Input::all());
     // process the login
     if ($validator->fails()) {
         return Redirect::to('members/create')->withErrors($validator)->withInput(Input::except('password'));
     } else {
         if (User::check_username(Input::get("username")) && User::check_email(Input::get("email"))) {
             $member = new Member();
             $member->username = Input::get('username');
             $member->password = md5(sha1(Input::get("password")));
             $member->name = Input::get('name');
             $member->email = Input::get('email');
             $member->status = 1;
             $member->save();
             //log
             Logfile::addData('thêm', 'thành viên', $member->id, $member->name);
             User::find($member->id)->roles()->attach(1);
             // redirect
             Session::flash('message', 'Thêm thanh vien mới thành công!');
             return Redirect::to('members');
         } else {
             Session::flash('message', 'ten dang nhap hoac email da ton tai');
             return Redirect::to('members/create')->with('error', 'ten dang nhap hoac email da ton tai')->withInput();
         }
     }
 }
コード例 #6
0
 public function createPre()
 {
     $member = new Member();
     $member->setIsActive(false);
     $member->save();
     return $member;
 }
コード例 #7
0
ファイル: doctor.php プロジェクト: HLitmus/WebApp
 public static function createOrg($opts)
 {
     $organization = \Organization::saveRecord(null, array("name" => $opts['user']->name));
     $centre = new \Centre(array("user_id" => $opts['user']->id, "organization_id" => $organization->id, "type" => "clinic", "department" => json_encode(RequestMethods::post("department", array("Clinic"))), "phone" => RequestMethods::post("org_phone", ""), "location_id" => $opts['location']->id));
     $centre->save();
     $member = new \Member(array("user_id" => $opts['user']->id, "centre_id" => $centre->id, "organization_id" => $organization->id, "designation" => "admin", "image" => "", "live" => 1));
     $member->save();
     return $organization;
 }
コード例 #8
0
ファイル: Transaction.php プロジェクト: nikonehauser/ptclient
 public static function activity_createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
 {
     $currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
     $when = time();
     $amount = $data['amount'];
     $recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
     $transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
     $currentTransfer->save($con);
     $recipient->save($con);
 }
コード例 #9
0
ファイル: SystemSetup.php プロジェクト: nikonehauser/pt
 public static function createMember(\Member $referralMember = null, array $data = array())
 {
     $member = new \Member();
     $member->fromArray(array_merge(self::$memberDefaults, $data));
     if ($referralMember) {
         $member->setRefererMember($referralMember, self::$con);
     }
     $member->save(self::$con);
     return $member;
 }
コード例 #10
0
 protected function executeTransaction($conn, $arguments = array(), $options = array())
 {
     $n = (int) $options['number'];
     $link = $options['link'];
     if (null !== $link) {
         $linkMember = Doctrine::getTable('Member')->find($link);
         if (!$linkMember) {
             throw new Exception("not found member: " . $link);
         }
     }
     for ($i = 0; $i < $n; $i++) {
         $member = new Member();
         $member->setName('dummy');
         $member->setIsActive(true);
         $member->save();
         $member->setName(sprintf($options['name-format'], $member->getId()));
         $member->save();
         $address = sprintf($options['mail-address-format'], $member->getId());
         self::setMemberConfig($member->id, 'pc_address', $address);
         self::setMemberConfig($member->id, 'mobile_address', $address);
         $password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
         self::setMemberConfig($member->id, 'password', md5($password));
         $this->logSection('member+', $member->getName());
         if (isset($linkMember)) {
             $memberRelationship1 = new MemberRelationship();
             $memberRelationship1->setMemberIdTo($member->id);
             $memberRelationship1->setMemberIdFrom($linkMember->id);
             $memberRelationship1->setIsFriend(true);
             $memberRelationship1->save();
             $memberRelationship1->free(true);
             $memberRelationship2 = new MemberRelationship();
             $memberRelationship2->setMemberIdTo($linkMember->id);
             $memberRelationship2->setMemberIdFrom($member->id);
             $memberRelationship2->setIsFriend(true);
             $memberRelationship2->save();
             $memberRelationship2->free(true);
             $this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
         }
         $member->free(true);
     }
 }
コード例 #11
0
ファイル: BasePilotAircraft.php プロジェクト: yasirgit/afids
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMember !== null) {
             if ($this->aMember->isModified() || $this->aMember->isNew()) {
                 $affectedRows += $this->aMember->save($con);
             }
             $this->setMember($this->aMember);
         }
         if ($this->aAircraft !== null) {
             if ($this->aAircraft->isModified() || $this->aAircraft->isNew()) {
                 $affectedRows += $this->aAircraft->save($con);
             }
             $this->setAircraft($this->aAircraft);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = PilotAircraftPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = PilotAircraftPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += PilotAircraftPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         if ($this->collMissionLegs !== null) {
             foreach ($this->collMissionLegs as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
コード例 #12
0
ファイル: MembersController.php プロジェクト: kenkode/xaraerp
 /**
  * Store a newly created member in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Member::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $member = new Member();
     if (Input::get('branch_id') != null) {
         $branch = Branch::findOrFail(Input::get('branch_id'));
         $member->branch()->associate($branch);
     }
     if (Input::get('group_id') != null) {
         $group = Group::findOrFail(Input::get('group_id'));
         $member->group()->associate($group);
     }
     if (Input::hasFile('photo')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('photo')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('photo')->move($destination, $photo);
         $member->photo = $photo;
     }
     if (Input::hasFile('signature')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('signature')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('signature')->move($destination, $photo);
         $member->signature = $photo;
     }
     $member->name = Input::get('name');
     $member->id_number = Input::get('id_number');
     $member->membership_no = Input::get('membership_no');
     $member->phone = Input::get('phone');
     $member->email = Input::get('email');
     $member->address = Input::get('address');
     $member->monthly_remittance_amount = Input::get('monthly_remittance_amount');
     $member->gender = Input::get('gender');
     if (Input::get('active') == '1') {
         $member->is_active = TRUE;
     } else {
         $member->is_active = FALSE;
     }
     $member->save();
     $member_id = $member->id;
     if (Input::get('share_account') == '1') {
         Shareaccount::createAccount($member_id);
     }
     Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'member creation', 'Member', '0');
     return Redirect::route('members.index');
 }
コード例 #13
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Member();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->memb_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #14
0
  private function createCluster($memberNum)
  {
    $memberIds = array();  
    for($i = 0; $i < $memberNum; ++$i)
    {
      $member = new Member();
      $member->setName('dummy');
      $member->setIsActive(true);
      $member->save();       
  
      $memberIds[] = $member->getId();
   
      $member->setName(sprintf('dummy%d', $member->getId()));
      $member->save();       
    
      $address = sprintf('*****@*****.**', $member->getId());

      $this->setMemberConfig($member->getId(), 'pc_address', $address);
      $this->setMemberConfig($member->getId(), 'mobile_address', $address);

      $password = '******';
      $this->setMemberConfig($member->getId(), 'password', md5($password));
      $member->free(true);
    }
    for($i = 0; $i < $memberNum; ++$i)
    {
      for($j = $i + 1; $j < $memberNum; ++$j) 
      {
        if ($i === $j) continue;
        $relation = new MemberRelationship();
        $relation->setMemberIdFrom($memberIds[$i]);
        $relation->setMemberIdTo($memberIds[$j]);
        $relation->setFriend(true);
        $relation->save();     
        $relation->free(true); 
      }
    }
  }
コード例 #15
0
 public function actionRegister()
 {
     if (Yii::app()->user->id) {
         $this->redirect(Yii::app()->user->returnUrl);
     }
     $model = new Member();
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         if ($_POST['Member']['password'] && $_POST['Member']['mname'] && $_POST['Member']['passwordrepeat']) {
             $name = $model->findByAttributes(array('mname' => $_POST['Member']['mname']));
             if ($name) {
                 header("Content-Type: text/html; charset=utf-8");
                 echo "<script language='javascript'>alert('用户名已经注册请选择其他的用户名!');  location.reload();</script>";
                 exit;
             }
             if ($_POST['Member']['password'] != $_POST['Member']['passwordrepeat']) {
                 /*throw new CHttpException(404,'两次输入的密码不一致!');
                 		$this->redirect(array('view','id'=>$model->id));*/
                 header("Content-Type: text/html; charset=utf-8");
                 echo "<script language='javascript'>alert('两次输入的密码不一致!');  location.reload();</script>";
                 exit;
             }
             if ($this->createAction('captcha')->getVerifyCode() != $_POST['Member']['verifyCode']) {
                 header("Content-Type: text/html; charset=utf-8");
                 echo "<script language='javascript'>alert('验证码输入错误!');  location.reload();</script>";
                 exit;
             }
             if ('agree' != $_POST['Member']['clause']) {
                 header("Content-Type: text/html; charset=utf-8");
                 echo "<script language='javascript'>alert('请仔细阅读条款!');  location.reload();</script>";
                 exit;
             }
         } else {
             header("Content-Type: text/html; charset=utf-8");
             echo "<script language='javascript'>alert('请输入昵称或密码!');  location.reload();</script>";
             exit;
         }
         if ($model->save(false)) {
             $this->redirect(Yii::app()->user->returnUrl);
         } else {
             header("Content-Type: text/html; charset=utf-8");
             echo "<script language='javascript'>alert('真实姓名跟身份证格式不正确,姓名只能是中文,身份证是15到18位!');  location.reload();</script>";
             exit;
         }
     }
     $this->render('register', array('model' => $model));
 }
コード例 #16
0
ファイル: MemberController.php プロジェクト: nctruong/inputen
 public function actionRegister()
 {
     $model = new Member();
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         if ($model->validate()) {
             $model->repass = md5($model->repass);
             $model->password = md5($model->password);
             if ($model->save()) {
                 $this->redirect(array(Yii::app()->getBaseUrl()));
             }
         }
     }
     $this->render('register', array('model' => $model));
 }
コード例 #17
0
ファイル: MemberController.php プロジェクト: nctruong/inputen
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->addToolbar();
     $model = new Member();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         $model->repass = $model->password;
         $model->point = 0;
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('form', array('model' => $model));
 }
コード例 #18
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     // is current user has the required privilege ?
     if (!Yii::app()->user->checkAccess('member_create')) {
         throw new CHttpException(403, 'You are not authorized to perform this action.');
     }
     $model = new Member();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #19
0
ファイル: MemberController.php プロジェクト: ACMASU/site
 public function create($data)
 {
     $input = $data['post'];
     $member = new Member();
     $member->firstName = $input['firstName'];
     $member->lastName = $input['lastName'];
     $member->email = $input['email'];
     $member->major = $input['major'];
     $member->dateJoined = date('Y-m-d');
     $member->grandfathered = false;
     $member->paid = false;
     try {
         $member->save();
         return ['view' => 'member/confirmation', 'data' => ['page' => 'Sign up confimation']];
     } catch (PDOException $e) {
         return ['view' => 'error', 'data' => ['message' => 'Could not register. Please contact support.']];
     }
 }
コード例 #20
0
 /**
  * 회원정보 삽입 컨트롤러 
  * @return JSON
  */
 public function postMember()
 {
     // auto trim
     array_map('trim', Input::only('userid', 'userpw', 'bluetoothaddr'));
     // 유효성 검사 rule
     $rules = array('userid' => Member::CONSTRAINT_USERID, 'userpw' => Member::CONSTRAINT_USERPW);
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Utils::result($validator->messages(), true);
     }
     // Create new member
     $member = new Member();
     $member->userid = Input::get('userid');
     $member->userpw = Input::get('userpw');
     $member->bluetoothaddr = Input::get('bluetoothaddr');
     // commit
     $member->save();
     return Utils::result($member->getKey());
 }
コード例 #21
0
	public function actionAdd()
	{
		$model = new Member;
		if(isset($_POST['Member']))
		{
			$_POST['Member']['password'] = md5($_POST['Member']['password']);
			$model->attributes=$_POST['Member'];
			$model->createtime = time();
			$model->updatetime = time();
			if($model->save()){
				Yii::app()->user->setFlash('success','添加成功!');
				$this->redirect(array('list'));
			}else{
				Yii::app()->user->setFlash('error','添加失败,请重试!');
			}
		}
		Yii::app()->session['myurl'] = $this->createUrl('add');
		$this->render('add',array('model'=>$model));
	}
コード例 #22
0
 public function actionIndex()
 {
     MemberNetwork::model()->updateNetwork(11, 10);
     $this->pageTitle = Lang::t('Register');
     //member model
     $member_model = new Member();
     $member_model_class_name = $member_model->getClassName();
     //user model
     $user_model = new Users(Users::SCENARIO_SIGNUP);
     $user_model->activation_code = Common::generateHash(microtime());
     $user_model->user_level = UserLevels::LEVEL_MEMBER;
     $user_model->timezone = SettingsTimezone::DEFAULT_TIME_ZONE;
     $user_model_class_name = $user_model->getClassName();
     //person model
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         if (isset($_POST[$member_model_class_name])) {
             $member_model->attributes = $_POST[$member_model_class_name];
             $member_model->validate();
         }
         if (isset($_POST[$user_model_class_name])) {
             $user_model->validatorList->add(CValidator::createValidator('CaptchaExtendedValidator', $user_model, 'verifyCode', array('allowEmpty' => !CCaptcha::checkRequirements())));
             $user_model->attributes = $_POST[$user_model_class_name];
             $user_model->validate();
         }
         if (isset($_POST[$person_model_class_name])) {
             $person_model->attributes = $_POST[$person_model_class_name];
             $person_model->validate();
         }
         if (!$member_model->hasErrors() && !$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $member_model->id = $user_model->id;
                 $member_model->save(FALSE);
                 Yii::app()->user->setFlash('success', Lang::t('Check your email for account activation email.'));
                 $this->refresh();
             }
         }
     }
     $this->render('index', array('member_model' => $member_model, 'user_model' => $user_model, 'person_model' => $person_model));
 }
コード例 #23
0
 /**
  * 新加入一个用户
  *  @param unknown_type $userId
  */
 public function addMember($userId, $roles = array())
 {
     $owner = $this->getOwner();
     $member = Member::model()->findByAttributes(array('memberableEntityId' => $owner->entityId, 'userId' => $userId));
     if (!$roles) {
         $roles = $this->getDefaultRoles();
     }
     if (!$member) {
         //插入一条新数据
         $member = new Member();
         $member->userId = $userId;
         $member->memberableEntityId = $owner->entityId;
         $member->addTime = time();
         $member->setArrRoles($roles);
         $result = $member->save();
         $this->onAdded(new CEvent());
         return $result;
     }
     return false;
 }
コード例 #24
0
 public function getLogin($social)
 {
     try {
         switch ($social) {
             case 'facebook':
                 $su = \Social::facebook('user');
                 break;
             case 'google':
                 $su = \Social::google('user');
                 break;
             default:
                 $su = null;
         }
         if ($su === null) {
             return \Redirect::route('frontend.index');
         }
         $m = \Member::where('uid', '=', $su->id)->where('social', '=', $social)->first();
         if ($m == null) {
             $m = new \Member();
             $m->uid = $su->id;
             $m->social = $social;
             $m->name = $su->name;
             $m->email = $su->email;
             if ($social == 'facebook') {
                 if (isset($su->birthday)) {
                     $m->birthday = date('Y-m-d', strtotime($su->birthday));
                 }
                 if (isset($su->gender)) {
                     $m->gender = substr($su->gender, 0, 1);
                 }
             }
             $m->save();
         }
         // register user into Auth that is a global variable
         \Auth::login($m);
         return \Redirect::route('frontend.index');
     } catch (Exception $e) {
         echo $e->getMessage();
         exit;
     }
 }
コード例 #25
0
ファイル: MemberController.php プロジェクト: ARAYASOFT/crm
 public function actionRegister()
 {
     //echo print_r($_POST);
     if (!empty($_POST)) {
         $members = new Member();
         $members->username = $_POST['username'];
         $members->password = $_POST['password'];
         $members->email = $_POST['email'];
         $members->fname = $_POST['fname'];
         $members->lname = $_POST['lname'];
         $members->gender = $_POST['gender'];
         $members->phone = $_POST['phone'];
         $members->create_date = date('Y-m-d h:i:sa');
         if ($members->save()) {
             Yii::app()->session['fname'] = $_POST['fname'];
             $this->redirect(array("Member/Login"));
         }
     }
     $members = new Member();
     $this->render("//Member/Register", array("member" => $members));
 }
コード例 #26
0
ファイル: Transaction.php プロジェクト: nikonehauser/pt
 public static function createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
 {
     $currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
     $when = time();
     if (!$con->beginTransaction()) {
         throw new Exception('Could not begin transaction');
     }
     try {
         $amount = $data['amount'];
         $recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
         $transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
         $currentTransfer->save($con);
         $recipient->save($con);
         if (!$con->commit()) {
             throw new Exception('Could not commit transaction');
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
コード例 #27
0
ファイル: vendor.php プロジェクト: HLitmus/WebApp
 /**
  * @before _session
  */
 public function preregister()
 {
     $this->seo(array("title" => "Register", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if (RequestMethods::post("department")) {
         $exist = User::first(array("email = ?" => RequestMethods::post("email")), array("id"));
         if (!$exist) {
             $user = new User(array("name" => RequestMethods::post("name"), "email" => RequestMethods::post("email"), "phone" => RequestMethods::post("phone"), "password" => rand(100000, 9999999), "gender" => RequestMethods::post("gender"), "birthday" => ""));
             $user->save();
             $organization = \Organization::saveRecord();
             $location = \Location::saveRecord($user);
             $centre = new Centre(array("user_id" => $user->id, "organization_id" => $organization->id, "type" => "lab", "department" => json_encode(RequestMethods::post("department")), "phone" => RequestMethods::post("org_phone"), "location_id" => $location->id));
             $centre->save();
             $member = new Member(array("user_id" => $user->id, "centre_id" => $centre->id, "organization_id" => $organization->id, "designation" => "admin", "image" => "", "live" => "1"));
             $member->save();
             Shared\Services\Mail::notify(array("template" => "vendorRegister", "subject" => "Welcome to HealthLitmus.com", "user" => $user));
             $this->redirect("/auth/success");
         } else {
             $view->set("message", "User Already Exists");
         }
     }
 }
コード例 #28
0
 public function signupAction()
 {
     $msg = "";
     if (isset($_POST['ssnSignUp']) && isset($_POST['firstnameSignUp']) && isset($_POST['lastnameSignUp']) && isset($_POST['monthSignUp']) && isset($_POST['daySignUp']) && isset($_POST['yearSignUp']) && isset($_POST['sexSignUp']) && isset($_POST['phoneSignUp']) && isset($_POST['password1SignUp']) && isset($_POST['password2SignUp']) && isset($_POST['emailSignUp'])) {
         if (Members::checkSSNAlreadyExist($_POST['ssnSignUp']) == false) {
             $newMember = new Member();
             $msg = "";
             // use member : save
             $newMember->save($_POST['ssnSignUp'], $_POST['firstnameSignUp'], $_POST['lastnameSignUp'], $_POST['daySignUp'], $_POST['monthSignUp'], $_POST['yearSignUp'], $_POST['emailSignUp'], $_POST['password1SignUp'], $_POST['sexSignUp'], NULL, 0, $_POST['phoneSignUp']);
             $this->redirect('/index/index');
         } else {
             $msg = "User Already Exists";
         }
         unset($_POST);
     }
     $this->msg = $msg;
     $this->actualYear = date("Y");
     $tableau = array();
     $tableau[0] = 'none';
     $tableau[1] = 'none';
     $tableau[2] = 'none';
     $tableau[3] = 'none';
     $this->activeBar = $tableau;
 }
コード例 #29
0
 public function postSynclegacy()
 {
     set_time_limit(0);
     $mymerchant = Merchant::where('group_id', 4)->get();
     $count = 0;
     foreach ($mymerchant->toArray() as $m) {
         $member = Member::where('legacyId', $m['id'])->first();
         if ($member) {
         } else {
             $member = new Member();
         }
         foreach ($m as $k => $v) {
             $member->{$k} = $v;
         }
         if (!isset($member->status)) {
             $member->status = 'inactive';
         }
         if (!isset($member->url)) {
             $member->url = '';
         }
         $member->legacyId = new MongoInt32($m['id']);
         $member->roleId = Prefs::getRoleId('Merchant');
         $member->unset('id');
         $member->save();
         $count++;
     }
     return Response::json(array('result' => 'OK', 'count' => $count));
 }
コード例 #30
0
ファイル: create.php プロジェクト: slijm/e107dkp
<?php

require_once e_PLUGIN . "e107dkp/includes/parsers/" . $_POST['parser'] . "/Parser.php";
require_once e_PLUGIN . "e107dkp/includes/models/Member.php";
global $ns;
$parser = new Parser($_POST['raidlog']);
// Report new members created.
$text .= "<h2>Raid Log Parse Report</h2>";
$text .= "<h3>Attendee Parsing Messages</h3><ul style=\"list-style: none;\">";
$attendees = array();
foreach ($parser->getAttendees() as $attendee) {
    $member = Member::loadByName($attendee->name);
    if (!$member) {
        $member = new Member($attendee->name);
        $member->save();
        $text .= "<li>The attendee, " . $member->getName() . ", has not been seen before. A new record has been created.</li>";
        $attendees[] = $member;
    } else {
        $attendees[] = $member;
    }
}
$text .= "</ul>";
$text .= "<h3>Zone Parsing Messages</h3><ul style=\"list-style: none;\">";
$zone = Zone::loadByName($parser->getZone());
if ($zone == false) {
    $zone = new Zone($parser->getZone());
    $zone->save();
    $text .= "<p>The zone, " . $zone->getName() . ", has not been seen before. A new record has been created.</p>";
}
$text .= "</ul>";
$text = "<div style=\"text-align: center;\">" . $text . "</div>";