Exemplo n.º 1
0
 public function save(User_Model_Guest $user)
 {
     try {
         $length = 8;
         $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
         $randomdata = "";
         $offset = strlen($characters) - 1;
         for ($p = 0; $p < $length; $p++) {
             $randomdata .= $characters[mt_rand(0, $offset)];
         }
         $passSha = sha1($user->getPassword() . $randomdata);
         $update = date('Y-m-d H:i:s');
         $user = array('usremail' => $user->getEmail(), 'usrpassword' => $passSha, 'usrusertype_id' => $user->getUsertypeid(), 'usrrole_id' => $user->getRole(), 'usrregistered_date' => $user->getRegistereddate(), 'usruser_status_id' => $user->getUserStatusid(), 'usrpassphrase' => $randomdata, 'usrcreateddatetime' => $update, 'usripaddress' => $_SERVER["REMOTE_ADDR"]);
         $user_id = $this->getDbTable()->insert($user);
         return $user_id;
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
Exemplo n.º 2
0
 public function widgetUserRegistration($request)
 {
     try {
         $customer = new User_Model_Guest();
         $customer->setEmail(strtolower($request['emailAddress']))->setPassword($request['password'])->setUsertypeid(2)->setRole(4)->setRegistereddate(date('Y-m-d H:i:s'))->setUserstatisid(1)->setFirstname($request['firstName']);
         if (isset($name[1])) {
             $customer->setLastname($request['lastName']);
         }
         $mapper = new User_Model_GuestDataMapper();
         $customer_id = $mapper->widgetsave($customer);
         $values = array('emailAddress' => $request['emailAddress'], 'password' => $request['password']);
         $createLoginProf = $this->_process($values);
         if ($customer_id) {
             /* For E-Mail*/
             /*$mailmapper = new Application_Service_Communication();
             				$mailObj = new Communication_Model_Mail();
             				$mailObj->setMsgCode('Customer_Confirmation');
             //				$name = $request->firstName.' '.$request->lastName;
             				$data = array('UserName' => $request->username,
             							  'SenTo'    => $customer->getEmail());
             				$mailObj->setData($data);
             				$mailStatus = $mailmapper->SendMail($mailObj);*/
             /*For SMS*/
             /*if(isset($request['phone'])){
             			$smsObj = new Communication_Model_Sms();
             			$smsObj->setMsgCode('Customer_Confirmation');
             			$data = array(
             			 	'to'	=>	trim($request['phone'])
             			 );
             			 $smsObj->setData($data);
             			 $mailStatus = $mailmapper->SendSms($smsObj);
             		}*/
             return true;
         } else {
             return false;
         }
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }