示例#1
0
 public function save(Application_Model_Cookie $cookie)
 {
     $data = array('id' => $cookie->getId(), 'nick' => $cookie->getNick(), 'displaymode' => $cookie->getDisplayMode(), 'savename' => $cookie->getSaveName(), 'email' => $cookie->getEmail(), 'password' => $cookie->getPassword(), 'twitter' => $cookie->getTwitter(), 'facebook' => $cookie->getFacebook(), 'ccemail' => $cookie->getCCEmail(), 'created' => date('Y-m-d H:i:s'), 'updated' => date('Y-m-d H:i:s'));
     if (!isset($data['id']) || $data['id'] === 0 || $data['id'] === null || $data['id'] == "") {
         $data['id'] = Application_Model_Cookie::generateRandomKey();
         $cookie->setId($data['id']);
         $this->getDbTable()->insert($data);
     } else {
         unset($data['created']);
         //Added by Pre: Don't want to change Created date when updating.
         $this->getDbTable()->update($data, array('id = ?' => $data['id']));
     }
 }