コード例 #1
0
 public function save(Default_Model_User $user)
 {
     $data = array('username' => $user->getUsername(), 'password' => md5($user->getUsername() . $user->getPassword()), 'created' => date('Y-m-d H:i:s'), 'openid' => Zend_OpenId::absoluteURL('/openid/' . $user->getUsername()), 'user_type' => $user->getUserType());
     if (null === ($id = $user->getId())) {
         $id = $this->getDbTable()->insert($data);
     } else {
         $this->getDbTable()->update($data, array('id = ?' => $id));
     }
     return $id;
 }
コード例 #2
0
ファイル: User.php プロジェクト: Roave/issues
 public function insert(Default_Model_User $user)
 {
     $data = array('user_id' => $user->getUserId(), 'username' => $user->getUsername(), 'password' => $user->getPassword(), 'salt' => $user->getSalt(), 'register_time' => new Zend_Db_Expr('NOW()'), 'register_ip' => new Zend_Db_Expr("INET_ATON('{$_SERVER['REMOTE_ADDR']}')"));
     $db = $this->getWriteAdapter();
     $db->insert($this->getTableName(), $data);
     $userId = $db->lastInsertId();
     $user->setUserId($userId);
     $this->updateUserRoles($user);
     foreach ($user->getSettings() as $k => $v) {
         $this->insertUserSetting($user, $k, $v);
     }
     return $userId;
 }